背景:Compiling in Unicode but need to save txt in UTF-8(MFC)

解法:

CString cs_test=_T(“TEST”);
CT2A  _ cs_test( cs_test,CP_UTF8);

CFile m_sFile(_T("D:\test.txt"),CFile::modeWrite|CFile::modeCreate);

m_sFile.Write( _ cs_test,::strlen( _ cs_test));

posted on 2017-06-22 14:28  笨nora  阅读(188)  评论(0编辑  收藏  举报