Adding to a File, adds three more names to the NAMES.DAT file. - C++ File Stream

C++ examples for File Stream:Text File

Description

Adding to a File, adds three more names to the NAMES.DAT file.

Demo Code

#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;
}

Related Tutorials