[Top] [Prev] [Next] [Bottom]

setlocale(3)

setlocale(3)

Name

setlocale-modify and query a program's locale

Synopsis

#include <locale.h> 
char *setlocale (int category, const char *locale);

Description

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 theBEA TUXEDO 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.

Files

$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

Note

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 "/".

See Also

ctime(3C), ctype(3C), getdate(3C), localeconv(3C), printf(3S), strftime(3C), strtod(3C), environ(5), mklanginfo(1)



[Top] [Prev] [Next] [Bottom]