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

在程序初始化的时候调用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()里面就可以了.
 

猜你喜欢

转载自blog.csdn.net/hua_007/article/details/44117539