1ofstream myFile("/Your/File/Path/YourFilename.txt");//writing to this file
2if (myFile.is_open())
3{
4 myFile << "This is a line." << "\n";
5 myFile << "This is another line." << "\n";
6 myFile.close();
7}
8else
9 std::cout << "Unable to open file";