Defined in header
char* setlocale( int category, const char* locale);
setlocale function installs the specified system locale or its portion as the new C locale. The modifications remain in effect and influences the execution of all locale-sensitive C library functions until the next call to
locale is a null pointer,
setlocale queries the current C locale without modifying it.
|category||-||locale category identifier, one of the LC_xxx macros. May be null.|
|locale||-||system-specific locale identifier. Can be "" for the user-preferred locale or "C" for the minimal locale|
pointer to a narrow null-terminated string identifying the C locale after applying the changes, if any, or null pointer on failure.
During program startup, the equivalent of setlocale(LC_ALL, "C"); is executed before any user code is run.
Although the return type is char*, modifying the pointed-to characters is undefined behavior.
setlocale modifies global state which affects execution of locale-dependent functions, it is undefined behavior to call it from one thread, while another thread is executing any of the following functions: fprintf, isprint, iswdigit, localeconv, tolower, fscanf, ispunct, iswgraph, mblen, toupper, isalnum, isspace, iswlower, mbstowcs, towlower, isalpha, isupper, iswprint, mbtowc, towupper, isblank, iswalnum, iswpunct, setlocale, wcscoll, iscntrl, iswalpha, iswspace, strcoll, wcstod, isdigit, iswblank, iswupper, strerror, wcstombs, isgraph, iswcntrl, iswxdigit, strtod, wcsxfrm, islower, iswctype, isxdigit.
|This section is incomplete|
Reason: no example
| locale categories for setlocale |
C++ documentation for setlocale