【发布时间】:2011-11-05 19:55:47
【问题描述】:
如何在 C++ 中正确读写 cp866 编码的文本文件?
UPD:我找到了一种写入文件的方法
wofstream rstrm(fileName);
rstrm.imbue(locale("rus_rus.866"));
rstrm << text_in_cyrillic.c_str();
rstrm.close();
现在我怎样才能以类似的方式读取文件?我需要将文件内容读取到 tstring 对象。
【问题讨论】:
-
为什么需要?使用 UTF-8 怎么样?
std::string s; file >> s;也可以,但可能不是你想要的。 -
@ybungalobill 不幸的是,这不是我的情况。
标签: c++ file winapi encoding dos