C++ ofstream Adding to a File

Description

C++ ofstream Adding to a File

#include <fstream.h>
ofstream       fp;/*from  w  w w . ja v a  2s  .c  o  m*/
void main()
{
   fp.open("NAMES.DAT", ios::app);   // Adds to file.
   fp << "Johnny Smith\n";
   fp << "Laura Hull\n";
   fp << "Mark Brown\n";
   fp.close();                  // Release the file.
   return;
}



PreviousNext

Related