Re: gnome 1.2, localisation and C++ streams

Jean-Marc Valin <> writes:
> I have just upgraded to gnome 1.2 and noticed it caused very
> undesirable effects with C++ streams. My language settings are set
> to french. I noticed that calling gnome_init(...) changes the way
> C++ streams print and parse decimal numbers. 

gnome_init() is setting up the locale properly. C++ streams localize
their output by default, so floating point will be like the %g format
for printf(). You want the %f format for printf() which is not
localized (I don't think); in C++ this is done with the "fixed"

 cout << fixed << 100.234523 << endl;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]