This is an old revision of the document!


C++

Read

Monospaced Text

#include <fstream>

  • ofstream create, write into new file
  • ifstream read the existing file
  • fstream read & write

#include <fiostream.h> int main () { ofstream out(“out.txt”); if (out.is_open()) { out « “This is a line.\n”; out « “This is another line.\n”; out.close(); } return 0;