1 TCHAR* old_locale = _tcsdup( _tsetlocale(LC_CTYPE,NULL) ); 2 _tsetlocale( LC_CTYPE, _T("chs")); 3 4 CStdioFile oStdFileIS; 5 try 6 { 7 if (!oStdFileIS.Open(TEXT("成语字典byWLS勿用于商业用途.txt"),CFile::modeRead)) 8 { 9 //失败 10 } 11 } 12 catch (CFileException* e) 13 { 14 //异常 15 16 delete e; 17 } 18 19 CString strIS; 20 while(oStdFileIS.ReadString(strIS)) 21 { 22 //处理 23 } 24 25 oStdFileIS.Close(); 26 27 _tsetlocale( LC_CTYPE, old_locale ); 28 free( old_locale );