I have the following piece of code in C++:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main(){
wstring ws1 = L"Infinity: \u2210";
wstring ws2 = L"Euro: €";
wchar_t w[] = L"Sterling Pound: £";
wfstream out("/tmp/unicode.txt");
out.write(ws1.c_str(), ws1.size());
out << ws1 << endl << ws2 << endl << w << endl;
out.flush();
out.close();
}
The program compiles without problem but the file is never open let alone writen on. Moreover, if I use std::wcout
I still don't get the right output, just ?
for the infinity and pound symbols.
My system is g++ 4.4.3 running an ubuntu linux 10.4 64bits.