C++ examples for File Stream:Text File
Adding to a File, adds three more names to the NAMES.DAT file.
#include <fstream> using namespace std; ofstream fp;/*from w w w . j av a2s .c o m*/ void main() { fp.open("NAMES.DAT", ios::app); // Adds to file. fp << "test\n"; fp << "test\n"; fp << "test\n"; fp.close(); // Release the file. return; }