vs fstream 不能打开中文路径名文件

来源:互联网 发布:淘宝网上买东西流程 编辑:程序博客网 时间:2024/04/28 04:48
在程序初始化的时候调用setlocale()如下:
BOOL CtestiostreamApp::InitInstance()
{
     setlocale(LC_ALL,"Chinese-simplified");
    CWinApp::InitInstance();
    std::ifstream iput;
    iput.open("F:\\中文.txt");
    ASSERT(!iput.fail());
    return FALSE;
}
 
调用std::locale::global(std::locale("Chinese-simplified")), 也是在InitInstance()里面就可以了.
 
0 0
原创粉丝点击