Hello and welcome to healthcare forum.
As you said that you had flu recently, for which you might have taken analgesic
There medications are known to cause gastritis and sometime also bleeding from the gastric mucosa
This blood due to its reaction with acid gives black color to stool.
You will require a course of proton pump
inhibitor like pantoprazole
to your gastric ulcer.
Now onwards make habit of taking pain killer alonge with antacid.
Best of luck.