Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
setlocale() always returns "C"
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="yogeshmk, post: 3608923"] I'm writing an application which is required to function with many languages and also compile on Linux & windows. Here's how I find the locale .. # include <stdio.h> # include <locale.h> int main(void) { unsigned char* loc = NULL; loc = setlocale(LC_MESSAGES, NULL); puts (loc); return 0; } Depending upon what string 'loc' contains, I need to write "hello world" (or any other message) in the corrosponding language (there are separate header files with texts in different languages coded in a struct. I've ran this piece of code on RedHat linux (en_US.UTF-8), Windows XP (??) and Ubuntu linux (on which the `locale` *command* returns "en_IN.UTF-8" which is correct). However, I observe that the function always returns "C" as the locale. Q1. What explains this behaviour of 'setlocale()' Q2. Any other way to find out the currently set language on the computer? cheers! [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
setlocale() always returns "C"
Top