c++ write to file in different directory code example
Example: c++ write to file in directory
ofstream myFile("/Your/File/Path/YourFilename.txt");//writing to this file
if (myFile.is_open())
{
myFile << "This is a line." << "\n";
myFile << "This is another line." << "\n";
myFile.close();
}
else
std::cout << "Unable to open file";