Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ write to file

// writing on a text file
#include <iostream>
#include <fstream>
using namespace std;

int main () {
  ofstream myfile ("example.txt");
    myfile << "This is a line.
";
    myfile << "This is another line.
";
    myfile.close();
  return 0;
}
Source by cplusplus.com #
 
PREVIOUS NEXT
Tagged: #write #file
ADD COMMENT
Topic
Name
6+3 =