/********************************** /* /* #include <locale.h> /* /********************************** // 获取txt文件的全路径 CString strConfigIniPath = fileDlg.GetPathName(); CStdioFile fileAccount; if (fileAccount.Open(strConfigIniPath, CFile::typeText | CFile::modeRead)) { CString strValue(_T(" ")); // 处理UNICODE下【中文乱码】异常 char * pOldLocale = _strdup(setlocale(LC_CTYPE, NULL)); setlocale(LC_CTYPE, "chs"); while (fileAccount.ReadString(strValue)) { strVecAccount.push_back(strValue); strValue.Empty(); } // 处理完毕后,释放资源 setlocale(LC_CTYPE, pOldLocale); free(pOldLocale); } fileAccount.Close();