Пространства имён
Варианты
Действия

setlocale

Материал из cppreference.com
< c | locale

Заголовочный файл <locale.h>
char* setlocale( int category, const char* locale);
setlocale функция устанавливает указанной локали системы или ее часть, как новый язык C. Изменения остаются в силе и влияет на выполнение всех зависящих от языка C библиотечных функций до следующего вызова setlocale. Если locale является нулевым указателем, setlocale запрашивает текущий стандарт C без изменения его.
Original:
The 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 setlocale. If locale is a null pointer, setlocale queries the current C locale without modifying it.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

Содержание

[править] Параметры

category - макросов. Может быть нулевым .
Original:
locale -
Система конкретных идентификатор языка. Может быть "" для пользователей предпочтительный язык или "C" для минимального стандарта
Original:
system-specific locale identifier. Can be "" for the user-preferred locale or "C" for the minimal locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Возвращаемое значение

Указатель на узкой нулем строку определения языка C после применения изменений, если таковые имеются, или нулевой указатель в случае неудачи.
Original:
pointer to a narrow null-terminated string identifying the C locale after applying the changes, if any, or null pointer on failure.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Notes

Во время запуска программы, эквивалент setlocale(LC_ALL, "C"); выполняется перед любым пользователем код запускается.
Original:
During program startup, the equivalent of setlocale(LC_ALL, "C"); is executed before any user code is run.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Хотя возвращение типа char*, изменения, то к символов неопределенное поведение.
Original:
Although the return type is char*, modifying the pointed-to characters is undefined behavior.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Потому что setlocale изменяет глобальное состояние которых влияет на выполнение локали-зависимых функций, это неопределенное поведение, чтобы вызвать его из одной нити, а другой поток выполняет любую из следующих функций: 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.
Original:
Because 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.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Пример

[править] См. также

локали категории setlocale
Original:
locale categories for setlocale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(константа-макрос) [edit]