I'm doing a numerical simulation of gravity in C++ and I want to back up my results every time a single step is counted.
However, the way I do it now, the programm always overwrites the file. I guess I would be able to solve in by always saving the text in a different file or variable, but I wonder if there's an easier way to open a text file so that I wouldn't overwrite it.
My current "back-up code" looks like this:
fstream log;
log.open ("log.txt");
if (log.is_open())
{...
...
log.close();
}