1. 程式人生 > >vs fstream 不能開啟中文路徑名檔案

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()裡面就可以了.