我建了一个最简单的MFC程序,就改了这个OnOK函数,Debug下面直接不能编译,几百个错误。#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void CmfctestDlg::OnBnClickedOk()
{
// TODO: 在此添加控件通知处理程序代码
//OnOK(); wifstream infile(L"E:\\GotaBrowser\\release\\interpreter.txt", ios::in);
if (!infile)
{
AfxMessageBox(L"can not open");
}
wstring str;
getline(infile, str);
AfxMessageBox(str.c_str()); infile.close();
}另外Release下读的是乱码,我已在属性中设置的unicode.我的环境是VS2005

解决方案 »

  1.   

    你文件E:\\GotaBrowser\\release\\interpreter.txt里面的内容是Unicode的吗?
      

  2.   

    debug和release的工程配置是2套分开的设置,看看2套的字符集是否一致
      

  3.   


    #include <iostream>
    #include <fstream>
    #include <string>
    //using namespace std;
    void CmfctestDlg::OnBnClickedOk()
    {
        // TODO: 在此添加控件通知处理程序代码
        //OnOK();    std::wifstream infile(L"E:\\GotaBrowser\\release\\interpreter.txt", ios::in);
        if (!infile)
        {
            AfxMessageBox(L"can not open");
        }
        wstring str;
        getline(infile, str);
        AfxMessageBox(str.c_str());    infile.close();
    }
    试一下
      

  4.   

    MSXML2::XMLDOMDocument pXmlDoc->Load();
    但是没有pXmlDoc->UnLoad()之类的方法