setlocale function — Sets or queries locale
char* setlocale(int category, const char* locale)
The setlocale
function sets
the locale for a specific category
, which you must specify using one
of the LC_
macros. Use LC_ALL
to set all categories to the same
locale.
The locale
parameter is the
name of the locale. The default for all categories is the "C
" locale. The empty string ("") is an
implementation-defined native locale. The implementation can define
other possible values for locale
.
To query the current locale, pass a null pointer as the
locale
. Note that each category
might have a different locale, so, when querying for LC_ALL
, the return value might contain
multiple locale names.
The return value is a pointer to a string that contains the
new locale (or current locale if you are querying with a null
locale
parameter) for the
specified category
. If the locale
cannot be set, a null pointer is returned.