I currently have this to write to a file in my program. I have all the variables ready to put into the file I just have an issue.
void fileWrite(int score)
{
ofstream file;
file.open("MathGen.txt");
file << "The score was: " << score;
file.close();
}
So when this runs it creates the files and writes the score perfectly fine. But if I re-run the program and get a new score it will overwrite the old score. Is there any way to stop this from happening? I know in python you could use file write functions such as "a+". But that doesn't work here.