同样的代码,同一个文本文件:我在VC6.0中可以正常运行,在VC2010中读出来的全是乱码
CString str;
CFile file;
if (!file.Open("hello.txt",CFile::modeRead,NULL))
{
MessageBox("filed to open file");
}
CArchive ar(&file,CArchive::load);
while(ar.ReadString(str))
{
MessageBox(str);
}但是我发在VS2010中,如是用CArchive::WriteString写的文件,用ReadString可以正常读出,但是文件用记事本打开是乱码?为什么 会这样,字符集???我该怎么处理,我想在VS2010中用CArchive读文本文件
VCVisual Studio 2010
CString str;
CFile file;
if (!file.Open("hello.txt",CFile::modeRead,NULL))
{
MessageBox("filed to open file");
}
CArchive ar(&file,CArchive::load);
while(ar.ReadString(str))
{
MessageBox(str);
}但是我发在VS2010中,如是用CArchive::WriteString写的文件,用ReadString可以正常读出,但是文件用记事本打开是乱码?为什么 会这样,字符集???我该怎么处理,我想在VS2010中用CArchive读文本文件
VCVisual Studio 2010
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货