I have some questions, but I can´t find straight answer anywhere.
So, basically, I know what locale is, I know how to use (set) it, but what I dont know is
how is work behind the scene, and I would very like to know it. So, when I use functions for IO, lets say for example scanf do float, when I need to decide whether country use decimal point or comma (I am actually from decimal comma country :)),
does scanf function "look" to check the current locale?
But if I doesn´t set it in my code, does it by default creates some standard locale itself, OR does it get it from OS?
For example in the part of code when you get handle to console for stdout stderr and stdin?
By default your program will have the C
locale.
When you run setlocale(LC_ALL,"");
you will set the locale from the outside environment (or you can set just parts LC_*
).
By calling setlocale(LC_ALL,"specific_locale");
you will set the specific locale.
All I/O functions should follow the current locale (standard C I/O functions).
The behind-the-code behaviour depends on the operating system and compiler you are using.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With