Re: gnome 1.2, localisation and C++ streams



Jean-Marc Valin <jean-marc.valin@hermes.usherb.ca> 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"
manipulator:

 cout << fixed << 100.234523 << endl;

Havoc




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