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?
I am writing a program in C, which sorts words in a file appropriately
Share
Well, it simply means the default locale is
"C". What did you expect?Using
setlocalewith aNULLpointer will return the program’s current locale (not changing it).Using
setlocalewith""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.