CStdioFile Open()
场景:
关于CStdioFile.Open的问题(on line)
兄弟想做一个函数来写日志文件。
打算用CStdioFile.Open写:
CStdioFile.Open(pFileName, CFile::modeCreate|CFile::modeReadWrite|CFile::typeText);
CStdioFile.WriteString(strFullLog);
但是这样就每次都在文件中写一个,我想继续在文件中写,应该怎么设置。
------解决方案--------------------
CFile::modeNoTruncate Combine this value with modeCreate. If the file being created already exists, it is not truncated to 0 length. Thus the file is guaranteed to open, either as a newly created file or as an existing file. This might be useful, for example, when opening a settings file that may or may not exist already. This option applies to CStdioFile as well.
关于CStdioFile.Open的问题(on line)
兄弟想做一个函数来写日志文件。
打算用CStdioFile.Open写:
CStdioFile.Open(pFileName, CFile::modeCreate|CFile::modeReadWrite|CFile::typeText);
CStdioFile.WriteString(strFullLog);
但是这样就每次都在文件中写一个,我想继续在文件中写,应该怎么设置。
------解决方案--------------------
CFile::modeNoTruncate Combine this value with modeCreate. If the file being created already exists, it is not truncated to 0 length. Thus the file is guaranteed to open, either as a newly created file or as an existing file. This might be useful, for example, when opening a settings file that may or may not exist already. This option applies to CStdioFile as well.