我试图读取纯文本文件.在我的情况下,我需要读取每行的行,并处理该信息.我知道C++有阅读wchars的功能.我尝试了以下方法:
#include <fstream>
#include <iostream>
int main() {
std::wfstream file("file"); // aaaàaaa
std::wstring str;
std::getline(file, str);
std::wcout << str << std::endl; // aaa
}
Run Code Online (Sandbox Code Playgroud)
但正如你所看到的,它没有读完整行.读取"à"时会停止,这是非ASCII.我该如何解决?