Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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." << "
";
   myFile << "This is another line." << "
";
   myFile.close();
}
else
   std::cout << "Unable to open file";   
Source by www.go4expert.com #
 
PREVIOUS NEXT
Tagged: #write #file #directory
ADD COMMENT
Topic
Name
2+7 =