locale, gui vs command line question?




Hi,

A user has reported a problem with my app being unable to load a settings
file from the command line when the program runs without a GUI.

The OPs locale uses commas as the decimal point and the programs use of
locale changes when GTK is initialized.

However, the same file which does not load from the command line without
a GUI will load with the GUI up.

I want these files to always be written in the "C" locale so they're
portable across locales, but I don't want to clobber the GUI to do so.

I've read archived posts recommending to use the glib conversion
functions, however these are limited to double precision, and the
minimum precision my app is using is long double, as it also uses the
MPFR library for unlimited multiple precision maths.

I've not had to deal with locales before, and I'm trying to understand
what GTK does to the locale when it initializes so I can work around it
and save data files as "C" locale.  I've tried adding
setlocale(LC_NUMERIC, "C") to the start of main, and after calling
gtk_init, but it seems to make no difference.

Any help/pointers appreciated.
James Morris.

PS I asked this 4 hours ago on stackoverflow, but any question older than
an hour is practically dead and lost by that point.

http://stackoverflow.com/questions/2171527/how-do-i-remove-the-difference-in-locale-between-gui-and-commandline-interfaces-o



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