Save string to file - C++ File Stream

C++ examples for File Stream:stream

Description

Save string to file

Demo Code

#include <fstream>
using namespace std;
int main()/*from   ww  w  . j a v  a  2  s  . co  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;
}

Related Tutorials