#include<fstream>
#include<locale>
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
locale china("chs");
wcin.imbue(china);
wcout.imbue(china);
wfstream file;
file.imbue(china);
wstring str; //文件内容存到的目标字符串 str
wstring gstr; //临时变量,用来读入文件
file.open("Ci1.txt",ios::in|ios::out);
do{
str = str + gstr;
file>>gstr;
}
while(!file.eof());
file.close(); //关闭文件
wcout<<str<<endl;
}
程序可以通过编译器,但无法运行,显示:
请教这是什么问题。
还有,请问我这种读取中文文本TXT的方法科学吗?
有没有多快好省的方法