write into file cpp code example
Example 1: file reading c++
int a, b;
ifstream bd;
myfile.open("file.txt");
if (myfile.is_open())
while (bd >> a >> b)
cout << a << b << endl;
else cout << "ERROR";
Example 2: write to file in C++
ofstream myfile;
myfile.open("file.txt");
myfile << "write this to file"