wofstream 不能输出Unicode的真相

今天使用wofstream输出Unicode时候,发现类似如下的输出还是会出现问题:

wifstream wifs(L"file",ios::out);
wstring str = L"File content";
wifs<<L"    "<<endl;

发现了编译错误:

  二进制“>>”: 没有找到接受“overloaded-function”类型的右操作数的运算符(或没有可接受的转换)

后来查了百度,发现问题是这样的:

  https://blog.csdn.net/xujiezhige/article/details/17843831

posted @ 2018-04-22 12:05  泛未分晨  阅读(280)  评论(0编辑  收藏  举报