且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在C ++中读取UTF-8文件数据?

更新时间:2023-11-27 20:52:16

我相信您在name的迭代中使用的c类型使用了错误的类型.由于c用作地图的键,而namewstring,则应使用:

I believe you are using the wrong type for c used in the iteration over name. As c is used as key for the map, and name is a wstring, you should use:

for (wchar_t c : name)  outputfile << map[c]; 

代替:

for (char c : name)  outputfile << map[c]; 

不是吗?

希望这会有所帮助,斯特凡诺

Hope this may help, Stefano