can't write wide character/string to outputfile
asyropoulos@aol.com
asyropoulos@aol.com
Mon Jun 27 16:04:00 GMT 2011
>Thanks many of your help
>in my first program, after I change Euro's unicode to \x20ac
>then it do print EUR in my screen
>but my outfile file (unicode_txt) still contain nothing(exist but
length is
>zero)(which is out of
>expect, I assume it should print EUR as well as screen)
>plz help again, and thanks a lot in advance.
I have slightly modified the program
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main() {
wstring ws2 = L"Euro:\x20ac";
wofstream out("unicode.txt");
// out.imbue(locale("el_GR.UTF-8"));
out << ws2<< endl;
wcout << ws2;
}
and this prints the word Euro on the terminal while the
output file is still empty.
Regards,
Apostolos
More information about the Gcc-help
mailing list