ATMI C Function Reference
setlocale()
—Modifies and queries a program's locale.
#include <locale.h>
char *setlocale (int category, const char *locale);
setlocale()
selects the appropriate piece of the program's locale as specified by the category
and locale
arguments. The category
argument may have the following values:
LC_CTYPE
LC_NUMERIC
LC_TIME
LC_COLLATE
LC_MONETARY
LC_MESSAGES
LC_ALL
These names are defined in the locale.h
header file. For the BEA Tuxedo ATMI system compatibility functions, setlocale()
allows only a single locale
for all categories. Setting any category is treated the same as LC_ALL
, which names the program's entire locale.
A value of "C" for locale
specifies the default environment.
A value of "" for locale
specifies that the locale should be taken from an environment variable. The environment variable LANG
is checked for a locale.
At program startup, the equivalent of
setlocale(LC_ALL, "C")
is executed. This has the effect of initializing each category to the locale described by the environment "C".
If a pointer to a string is given for locale
, setlocale()
attempts to set the locale for all the categories to locale
. The locale
must be a simple locale, consisting of a single locale. If setlocale()
fails to set the locale for any category, a NULL pointer is returned and the program's locale for all categories is not changed. Otherwise, locale is returned.
A NULL pointer for locale
causes setlocale()
to return the current locale associated with the category
. The program's locale is not changed.
A thread in a multithreaded application may issue a call to setlocale()
while running in any context state, including TPINVALIDCONTEXT
.
$TUXDIR/locale/C/LANGINFO - time and money database for the C locale
$TUXDIR/locale/locale
/* - locale specific information for each
locale $TUXDIR/locale/C/*_CAT - text messages for the C locale
A composite locale is not supported. A composite locale is a string beginning with a "/", followed by the locale of each category, separated by a "/".
ctime
(3c), ctype
(3c), getdate
(3c), localeconv
(3c), strftime
(3c), strtod
(3c), printf
(3S), environ
(5) in a UNIX system reference manual