setlocale not working as expected

Frank De prins fdp at mcs.be
Thu Feb 23 23:10:31 PST 2012


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,

Frank De prins


More information about the Digitalmars-d-bugs mailing list