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

Re: Locale breaks scanf()



Andreas Tille <tille@physik.uni-halle.de> writes:

> I've detected a strange bug when using setlocale().  The conversion
> from strings to double for instance using scanf() is broken.
> 
> I have installed libc6 Version 2.0.7.19981211-6.  This problem doesn't
> occure at home on my clean slink system.  Here is a very small
> code example:

(snip code example)

> On my system I get the output:
> 
>  > scantest
> 0.5 is converted to 0 (1 input items assigned)
> 
> Could somebody explain this?

Your locale environment variable settings (LC_ALL or LANG) are
probably set to a locale where the decimal separator is ',' (comma),
not '.' (dot).

	- Ruud de Rooij.


Reply to: