[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: locale affects (infects? ;) strtod()
- From: Tom Tromey <tromey creche cygnus com>
- To: Tim Janik <Tim Janik Hamburg Netsurf DE>
- Cc: Gtk+ Mailing List <gtk-list redhat com>, GNOME mailing-list <gnome nuclecu unam mx>
- Subject: Re: locale affects (infects? ;) strtod()
- Date: 20 Dec 1997 00:26:00 -0700
Tim> if strtod() can't be used to parse _international_ *rc files,
Tim> which function should be used instead to do string->float
Tim> conversions?
As you've discovered, strtod() does locale-specific conversion. If
you want to use the C locale rules, then set the locale to C before
calling strtod(). You only have to set LC_NUMERIC:
#include <locale.h>
char *old = setlocale (LC_NUMERIC, "C");
... strtod (...) /* will use C rules */
setlocale (LC_NUMERIC, old);
Tom
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]