Write To A Text File
Date : October 29, 2004
This snippet will write a text file.
#include <fstream.h> int main() { ofstream outfile("example.txt"); if (outfile.is_open()) { outfile << "This is a line.n"; outfile << "This is another line.n"; outfile.close(); } return 0; }
Tags:
C++