Mega Code Archive
Categories
/
C++ Tutorial
/
File Stream
Output to file line by line
#include
int main () { ofstream myfile("test.txt"); if (myfile.is_open()) { myfile << "This outputting a line.\n"; myfile << "this is another line.\n"; myfile.close(); } return 0; }