This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: can't write wide character/string to outputfile


On Mon, 2011-06-27 at 04:48 -0400, asyropoulos@aol.com wrote:
> >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
> 
> 
> 
>   
there is a article:
http://cboard.cprogramming.com/cplusplus-programming/72657-unicode-file-i-o.html
talk about it
but
if you or any advanced c/g++ programers have better way, especailly
the way similar as code above(cppcookbook, by Metrowerk/CodeWarrior)
on any newer version of g++(above 4.5.2), plz post, thanks your help
Eric



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]