unicode版本下打开包含中文路径文件失败解决方案

   CString fullPath = path.TrimRight(_T("\\")) + _T("\\") + fileName;
    string strPath = LQAS_DATA::CStringToString(fullPath);

    locale::global(locale(""));

    fstream ofile(strPath.c_str() ,ios_base::out | ios_base::trunc | ios_base::binary);
    
    if(ofile.fail())
    {
        locale::global(locale("C"));
        return false;;
    }
    ofile<< output;

    locale::global(locale("C"));

    ofile.close();

posted @ 2013-03-13 10:18  忆民  阅读(309)  评论(0编辑  收藏  举报