Each system and specific compiler implementation may provide different choices of locales to be selected (using function setlocale), but at least two locales are available to choose for any C program:
- The "C" locale is the minimal locale. It is a rather neutral locale which has the same settings across all systems and compilers, and therefore the exact results of a program using this locale are predictable. This is the locale used by default on all C programs.
- The system's default locale (which is specified by an empty C-string: ""). It is the locale configuration provided by the environment where the application is running. This usually contains more localization information than the "C" locale.
This header declares the lconv type and the functions setlocale and localeconv, along with several macros to be used with them. These are used to define locale specific information.
Notice that locale configuration affects the behavior of many functions within the standard C library:
- In <cstring> (<string.h>), functions strcoll and strxfrm are affected by character transformation rules.
- In <cctype> (<ctype.h>), all functions except for isdigit and isxdigit are affected by the extended character set selected.
- In <cstdio> (<stdio.h>), formatted input/output operations are affected by character transformation rules and decimal-point character set in the numeric formatting settings.
- In <ctime> (<time.h>), the function strftime is affected by the time formatting settings.
- In this header, it affects the value returned by its functions setlocale and localeconv.
But some locale information is also provided to programs to better render its output in a locale sensitive manner (localeconv).
The functions provided in this header are:
|setlocale||Set or retrieve locale (function)|
|localeconv||Get locale formatting parameters for quantities (function)|
The header also declares a structure type:
|lconv||Formatting info for numeric values (type)|