c++ .in file code example
Example 1: opening file in c++
/ fstream::open / fstream::close
#include <fstream> // std::fstream
int main () {
std::fstream fs;
fs.open ("test.txt", std::fstream::in | std::fstream::out | std::fstream::app);
fs << " more lorem ipsum";
fs.close();
return 0;
}
Example 2: write to file in C++
ofstream myfile;
myfile.open("file.txt");
myfile << "write this to file"