Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

The locale concept

&pagelevel(3)&pagelevel

The principle underlying the concept of “locale” is to enable the behavior of C programs to be modified to take account of national conventions, standards and languages.

The locale directly affects the execution of certain C library functions. The localeconv function makes locale-specific information available in a structure which can be used for formatted output (printf, fprintf etc.).

The locale comprises the following categories:

LC_COLLATE

The sort sequence of the character set affects the behavior of the
strcoll, strxfrm, wcscoll and wcsxfrm functions.

LC_CTYPE

Classification of the characters affects the behavior of the character
handling macros is... (not isdigit, iswdigit, isxdigit or
iswdigit), tolower, toupper, towctrans, towlower, towupper,
strlower, strupper and wctrans.

LC_MONETARY

The conventions for representing monetary values (e.g. currency)
affect the values supplied by localeconv.

LC_NUMERIC

The conventions for representing non-monetary numerical values
(e.g. decimal point, sign) affect the type of decimal point for
formatted input/output and for the conversion of strings (atof,
strtod, wcstod) and also the values supplied by localeconv.

LC_TIME

The conventions for representing the date and time affect the
behavior of strftime and wcsftime.

The C runtime system provides some predefined locales (see section “Predefined locale C”). Users can also define their own locales (see section “Compatible locales V1CTYPE and V2CTYPE”).

CRTE provides the predefined locales De.EDF04F and De.EDF04F@euro to support the euro. The only difference between these two locales lies in the category LC_MONETARY, which represents the German Mark (DM) for the locale De.EDF04F, and the euro for the locale De.EDF04F@euro.

The locale under which the C program is to run is selected with the setlocale function. Detailed descriptions of the C library functions mentioned in this section can be found in the reference section of this manual.
The locale C is preset by default, provided the main routine is not a C V1.0 object; in this case, the locale “V1CTYPE” or LC_C_V1CTYPE is set automatically when the program starts.