vs2010-mfc-vc++ 下解决writestring不成功的问题 unicode 宽字符

vs2010-mfc-vc++ 下解决writestring不成功的问题 unicode 宽字符

CString filename;
filename = “data.csv”;//

CStdioFile newfile(filename,CFile::modeCreate|CFile::modeWrite);//

CString strline;

strline = strcode+L”,”+pApp->appraisal[i]+L”,”+pApp->item[j]+L”,”+pApp->choice[k]+L”\n”;
//MessageBox(strline);
char * old_locale = _strdup( setlocale(LC_CTYPE,NULL));
setlocale(LC_CTYPE,”chs”);//设定
newfile.WriteString(strline+L”\n”);//正常写入
setlocale(LC_CTYPE,old_locale);//还原区域设定
free(old_locale);

 

One comment

Leave a Reply