Making a unicode text file
Code:
#include <iostream>
#include <string>
#include <fstream>
#include <sstream>
int main(int argc, char ** argv)
{
using namespace std;
wifstream in(argv[1]);
wofstream out((std::string(argv[1]) + ".xxx").c_str());
wstring ws, e;
wchar_t x[1];
in.read(x, 1);
out.write(x, 1);
while(getline(in, ws))
{
wstringstream ww(ws);
while(getline(ww, e, L'\t'))
{
out << e << endl;
}
}
}
The file that I produce is not read properly by a text editor (notepad, vim, whatever) while the other that I read is. I have exsamined the binary of the file and the BOM is the same, as is the format of the unicode character data. What should I do