C++ ofstream Save string to file

Description

C++ ofstream Save string to file

#include <fstream>
using namespace std;
int main()//from   w  w  w .j a  va  2 s  .  c o m
{
   ofstream outfile("TEST.TXT");       //create file for output
   outfile << "this is a test!\n";
   outfile << "another line\n";
   outfile << "word word word,\n";
   outfile << "test test test.\n";
   return 0;
}



PreviousNext

Related