【发布时间】:2009-05-03 01:59:36
【问题描述】:
在处理不祥的印刷撇号 (') 时,我刚刚遇到了一些奇怪的行为,而不是打字机撇号 (')。与宽字符串文字一起使用时,撇号会中断 wofstream。
此代码有效
ofstream file("test.txt");
file << "A’B" ;
file.close();
==> A'B
此代码有效
wofstream file("test.txt");
file << "A’B" ;
file.close();
==> A'B
此代码失败
wofstream file("test.txt");
file << L"A’B" ;
file.close();
==> 一个
此代码失败...
wstring test = L"A’B";
wofstream file("test.txt");
file << test ;
file.close();
==> 一个
有什么想法吗?
【问题讨论】:
-
以什么方式失败?例外?
-
字符串被截断。
标签: c++ unicode widestring wofstream