how to write into file in c++ code example
Example 1: create file c++
// using ofstream constructors.
#include <iostream>
#include <fstream>
std::ofstream outfile ("test.txt");
outfile << "my text here!" << std::endl;
outfile.close();
Example 2: write to file in C++
ofstream myfile;
myfile.open("file.txt");
myfile << "write this to file"