***Appending - Instead of Over-Writing***

Team,

I would like to put a header onto a csv - then append to it consistently until my program ends - ie - NOT over-writing anything.
How would I do this successfully?

1
2
3
4
5
  myfile.open ("output.csv");
  myfile << "a" << , << "b" << "," << c
  
//a loop here do {myfile << "d" << "," << "e" << "," << "f"} while ();
1
2
// open for output in append mode (create a new file only if the file does not exist)
std::ofstream file( file_name, std::ios::app ) ;
Last edited on
Topic archived. No new replies allowed.