Language Issues

I have some questions, but I can not find a direct answer anywhere.

So basically, I know what a locale is, I know how to use it (install), but what I don't know is

  • like work behind the scenes, and I would really like to know that. Therefore, when I use functions for I / O, say, for example, scanf do float, when I need to decide whether the country will use a decimal point or a comma (I'm really from a decimal point :)),

  • does scanf look to check the current locale?

  • But if I do not install it in my code, does it by default create some standard language, or does it get it from the OS?

  • For example, in the code part, when do you get the console descriptor for stdout stderr and stdin?

+7
source share
1 answer

By default, your program will have the locale standard C

When you run setlocale(LC_ALL,""); , you install the locale from the external environment (or you can install only parts of LC_* ).

By calling setlocale(LC_ALL,"specific_locale"); , you set the specific locale.

All I / O functions must match the current language (standard C I / O functions).

The behavior behind the code depends on the operating system and the compiler you are using.

+5
source

All Articles