2008/10/16 Paul Davis <[EMAIL PROTECTED]>:
> you need to ensure that a portable locale is used when using stdio
> calls. my preferred method is this little class. Put one of this in any
> scope where you do stdio (input or output) and the locale is switched
> and then automatically restored when leaving the scope.
>
> struct LocaleGuard {
> LocaleGuard (const char*);
> ~LocaleGuard ();
> const char* old;
> };
>
> LocaleGuard::LocaleGuard (const char* str)
> {
> old = strdup (setlocale (LC_NUMERIC, NULL));
> if (strcmp (old, str)) {
> setlocale (LC_NUMERIC, str);
> }
> }
>
> LocaleGuard::~LocaleGuard ()
> {
> setlocale (LC_NUMERIC, old);
> free ((char*)old);
> }
Thanks. I didn't know the 'setlocale' function, which was the one I
needed. I've just added a 'setlocale (LC_ALL, "C");' to my code, as I
don't want any locale changes anywhere in the application.
Thanks,
Søren
_______________________________________________
gtkmm-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtkmm-list