佚名通过本文主要向大家介绍了
用fstream写文件输出中文UNICODE,xp下正常,但在2003server系统下显示很奇怪的字符,怎么回事?等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: 用fstream写文件输出中文UNICODE,xp下正常,但在2003 server系统下显示很奇怪的字符,怎么回事?
描述:
解决方案1:
描述:
用fstream写文件输出中文(UNICODE),xp下正常,但在2003 server系统下显示很奇怪的字符,怎么回事?
代码如下:
void CLogFile::Writeln(tstring strVal)
{
tstring outData = strVal + _T("\n");
fstream fos;
fos.open("D:\\logfile.txt", ios::out | ios::app ,0);
#ifdef UNICODE
USES_CONVERSION;
std::string outStr = W2A(outData.c_str());
fos.write(outStr.c_str(),outStr.size());
#else
fos.write(outData.c_str(),outData.size());
#endif
fos.close();
}
解决方案1:
顶一下