已定义UNICODE,为何输出还是乱码?求解,谢谢!
#include <iostream>#include <fstream>#include <cstdlib>#include <string>using namespace std;#define INFILE "MyData.txt"#define OUTFILE "MyData.txt"int main(int, char **, char **){ wifstream ifs(INFILE, ios::in); if (ifs) { cerr << "Error: " << INFILE<< "already exists" << endl; exit(1); } wofstream ofs(OUTFILE, ios::out); if (!ofs) { cerr << "Error: unable to write to " << OUTFILE << endl; exit(2); } const wstring strStuff = L"新概念英语与习题解答"; const wchar_t* pStr = L"3: const char * "; ofs << L"1: A literal string" << endl; ofs.write(pStr, wcslen(pStr)); ofs << endl; ofs << strStuff << endl;}