Name
setlocale function — Sets or queries locale
Synopsis
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.
Warning
Do not modify the string returned from setlocale
. A call to setlocale
might overwrite the contents
of the string returned from an earlier call (or simultaneous call
in a multithreaded program).
Get C++ In a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.