Mega Code Archive

 
Categories / C++ Tutorial / File Stream
 

Open a file for appending and append

#include <fstream> #include <iostream> using namespace std;     int main ()  {   char buffer[256];     fstream myfile;   //open for appending and append   myfile.open("test.txt",ios::app);   myfile << " Hey this is another line \n";   myfile.close();     return 0; }