Re: Locale breaks scanf()
On 1999/04/22, Andreas Tille wrote:
> On 22 Apr 1999, Ruud de Rooij wrote:
> > Your locale environment variable settings (LC_ALL or LANG) are
> > probably set to a locale where the decimal separator is ',' (comma),
> > not '.' (dot).
> Hmm, that's true. It is set to de_DE. But I'd really dislike it
> if the user has to ship different input, when using different
> LC_*! Is there any solution to use '.' in any case as separator??
> OK, I could substitute it in my program, but it seems me really
> strange. I consider this behaviour of locale as insane.
You could explicitly set the locale settings for numeric values back to the
default, using
setlocale(LC_NUMERIC, "C");
Greetings,
Ruud de Rooij.
--
Ruud de Rooij
r.c.m.derooij@twi.tudelft.nl
http://sepc.twi.tudelft.nl/~derooij/
Reply to: