designerrr
designerrr

Reputation: 322

setlocale in Mac OS X 10.7 lion

I am writing a program in C, which sorts words in a file appropriately to a chosen localization and encoding. I am using MAC OS X 10.7. The problem is, the call setlocale(LC_CTYPE, NULL) always returns C, even if I call setlocale(LC_CTYPE, "") before that to set LC_CTYPE to the default environment settings. Can somebody explain what is going on?

Upvotes: 0

Views: 572

Answers (1)

Macmade
Macmade

Reputation: 53930

Well, it simply means the default locale is "C". What did you expect?

Using setlocale with a NULL pointer will return the program's current locale (not changing it).

Using setlocale with "" will select the user's locale, based on the software's environment variables.

So in your case, it's "C" in both case. Seems like normal behavior.

Upvotes: 2

Related Questions