Non-Confidential | ![]() | ARM 100073_0608_00_en | ||
| ||||
Home > The C and C++ Library Functions Reference > setlocale() |
Defined in locale.h, the setlocale()
function selects the appropriate locale as specified by the category
and locale
arguments.
char *
setlocale(int
category
,const char
*locale
);
Use the setlocale()
function to change or
query part or all of the current locale. The effect of the
argument for each value is:category
LC_COLLATE
Affects the behavior of strcoll().
LC_CTYPE
Affects the behavior of the character handling functions.
LC_MONETARY
Affects the monetary formatting information
returned by localeconv()
.
LC_NUMERIC
Affects the decimal-point character for the
formatted input/output functions and the string conversion functions and the numeric
formatting information returned by localeconv()
.
LC_TIME
Can affect the behavior of strftime()
. For currently supported locales, the option has no
effect.
LC_ALL
Affects all locale categories. This is the bitwise OR of all the locale categories.
A value of "C"
for
specifies the minimal environment
for C translation. An empty string, locale
""
, for locale
specifies the implementation-defined native environment.
At program startup, the equivalent of setlocale(LC_ALL,
"C")
is executed.
Valid
values depend on which locale
__use_
symbol is imported (X
_ctype__use_iso8859_ctype
, __use_sjis_ctype
, or __use_utf8_ctype
), and on user-defined locales.
__use_X
_ctype
symbol can be imported.If a pointer to a string is given for locale and the selection is valid, the string associated with the specified category for the new locale is returned. If the selection cannot be honored, a null pointer is returned and the locale is not changed.
A null pointer for locale causes the string associated with the category for the current locale to be returned and the locale is not changed.
If category is LC_ALL
and the most recent successful locale-setting call uses a category other
than LC_ALL
, a composite string might be returned. The
string returned when used in a subsequent call with its associated category restores that
part of the program locale. The string returned is not modified by the program, but might be
overwritten by a subsequent call to setlocale()
.