one more file io (?)
-
:confused: How do you write in mfc to files but manually like
f.write("something");
or similar to that and how do you start a newline in a file output -
:confused: How do you write in mfc to files but manually like
f.write("something");
or similar to that and how do you start a newline in a file outputGoogle
CStdioFile
and use theWriteString()
method to write a newline terminated line of text to the file. /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com -
:confused: How do you write in mfc to files but manually like
f.write("something");
or similar to that and how do you start a newline in a file outputHi, you have either to work with the MFC CFile class or to work with the standad file stream of the C++ using CFile class CFile myFile; /* This will cause a file to be created and if there is a file with the same name to be truncated */ myFile.Open("FileName.txt",CFile::modeCreate|CFile::modeReadWrite); /* This will cause a file to be created and if there is a file with the same name to be appended */ myFile.Open("FileName.txt",CFile::modeCreate|CFile::modeNoTruncate|CFile::modeReadWrite); char* buf; CString strData; strData = "My data"; buf = new char[strData.GetLength()]; strcpy(buf,strData); myFile.Write(buf);