setlocale not working as expected

Jonathan M Davis jmdavisProg at gmx.com
Fri Feb 24 10:47:16 PST 2012


On Friday, February 24, 2012 08:10:31 Frank De prins wrote:
> Hello,
> 
> When I use setlocale with LC_ALL it does not seem to work.
> I use nlb_belgium and, when I print (writeln in console) a
> floating point number, I expect the decimal separator to be a
> comma. But it remains a dot.
> When I use 0 instead of LC_ALL, it does work.
> So I inspected the values defined for those locale cateory
> constants and they seem to be completely different from what I
> find in the Visual C++ headers. Is this possible? I mean, are
> they not expected to be the same, or is this vendor specific?
> 
> PS: This is how they are defined in VC:
> 
> #define LC_ALL 0
> #define LC_COLLATE 1
> #define LC_CTYPE 2
> #define LC_MONETARY 3
> #define LC_NUMERIC 4
> #define LC_TIME 5
> 
> Also, in VC++, the return value of setlocale is defined as char*
> whereas, in D, it is int. This makes it impossible to inspect
> the current locale.
> 
> Best regards and thanks for a wondderfull language,

This list is not intended to be posted to directly by anyone but bugzilla 
itself. If you have a bug, please report it at d.puremagic.com/issues (in 
which case, that would be messaged to this list). If you have a question about 
learning D, then post to digitalmars-d-learn, and if you have a general D 
question then, post it to digitalmars-d.

- Jonathan M Davis


More information about the Digitalmars-d-bugs mailing list