繁体   English   中英

无法使用函数Cfile在MFC中读取文件中的内容?

[英]Not able to read the contents in the file in MFC using the function Cfile?

如果我在文件中手动写入内容,则无法读取文件中的内容...如果已有内容已经能够读取内容...,但是如果我去手动在文件中写入内容,然后尝试要阅读,我无法阅读我已编辑的内容。请检查以下我正在阅读的代码。

CFile file;
if(file.open("C:\\users\\rakesh\\Desktop\\myText.txt",CFile::modeRead))
{ 
return false;
}
TCHAR buffer[50];//say content is small
file.read(buffer,50);
file.close();

看起来像一个unicode问题。 我的猜测是您的项目设置为使用unicode,但是您的编辑器编写的是ascii。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM