无法通过文件写入获得回车符?

时间:2015-06-21 16:05:42

标签: c++

而不是0回车0,我在下面的文本文件中得到00,有什么问题? 我甚至添加了flush命令,但在" 0" ??

之间仍然没有回车符
CFile p_File;
CString pBuffer;
DWORD ptext = 0;

ClientFile.Format(_T("Textfile.txt"));


if (!p_file.GetStatus(ClientFile, status))
    !p_file.Open(ClientFile, CFile::modeCreate | CFile::modeReadWrite);


else if (!p_file.Open(ClientFile, CFile::modeReadWrite))        
    MessageBox(NULL, (LPCWSTR) "Can't open file", (LPCWSTR) "file", MB_OK);




pbuffer.Format(_T("%1u\r\n"), ptext);



p_file.SeekToEnd();
p_file.Write(pbuffer, pbuffer.GetLength());
p_file.Flush();

p_file.SeekToEnd();
p_file.Write(pbuffer, pbuffer.GetLength());
p_file.Flush();

p_file.Close(); 

0 个答案:

没有答案