您的位置:首页 > 其它

CStdioFile WriteString 无法写入中文 已解决

2018-03-23 00:07 661 查看
转载:https://blog.csdn.net/mowwwcom/article/details/39555927

已亲自测试确实是这个问题,VS2010对Unicode汉字字符输出的支持还不是很好。

解决方法:

使用setlocale语句设定区域。

需要包含的头文件:

#include <locale>

CStdioFile file;

CFileException pError;

setlocale( LC_CTYPE, (“chs”));

if(!file.Open(_T(“ttt.txt”), CFile::modeReadWrite | CFile::modeCreate, &pError))
{
MessageBox(_T(“Tip”), _T(“open failed!”), MB_ICONWARNING);
}

file.WriteString(_T(” dear 静 where are you “));
file.Close();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐