I have a file that need to be open multiple times during the runtime. Each time some text are appendedd into the file. Here is the code:
ofstream fs;
fs.open(debugfile, fstream::app);
ostream_iterator<double> output(fs, " ");
copy(starting_point.begin(), starting_point.end(), output);
...
fs.open(debugfile, fstream::app);
ostream_iterator<double> output1(fs, " ");
copy(starting_point.begin(), starting_point.end(), output1);
My question is can I use one stream iterator "output" every time I open the file, e.g. some way to clean it?
Thanks