how do i read and write to a .txt file? and code/tutorials would be greatly appreciated.
Printable View
how do i read and write to a .txt file? and code/tutorials would be greatly appreciated.
Look up these functions in a C/C++ reference.
open()
read()
write()
close()
Kuphryn
Code:ofstream WriteFile;
WriteFile.open("MyFile.txt", ios::out);
if(!WriteFile.fail())
{
WriteFile << "Hello world!" << endl;
WriteFile.close();
}
... or the tutorial based on this site:
http://www.cprogramming.com/tutorial/lesson10.html
... or you could read the faq!
So many options.... :p