Namensräume
Varianten
Aktionen

std::setlocale

Aus cppreference.com
< cpp‎ | locale

 
 
Lokalisierungen Bibliothek
Locales und Facetten
Original:
Locales and facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
locale
Buchstaben-Klassifikation
Original:
Character classification
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Conversions
Original:
Conversions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Facet Kategorie Basisklassen
Original:
Facet category base classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Facet Kategorien
Original:
Facet categories
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Locale-spezifische Facetten
Original:
Locale-specific facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Code-Konvertierung Facetten
Original:
Code conversion facets
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
codecvt_utf8(C++11)
codecvt_utf16(C++11)
C locale
Original:
C locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
setlocale
localeconv
lconv
 
Defined in header <clocale>
char* setlocale( int category, const char* locale);
Die setlocale Funktion installiert das angegebene Gebietsschema oder einem Teil davon, wie die neue C locale. Die Änderungen bleiben wirksam und beeinflusst die Ausführung aller locale-sensitive C-Library-Funktionen bis zum nächsten Aufruf setlocale. Wenn locale ein NULL-Zeiger ist, fragt setlocale die aktuelle C locale ohne es zu ändern .
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.

Inhaltsverzeichnis

[Bearbeiten] Parameter

category - Makros. Kann null .
Original:
locale -
system-spezifische Gebietsschemas enthält. Kann "" für den Benutzer bevorzugten Gebietsschema oder "C" für die minimale locale
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.

[Bearbeiten] Rückgabewert

Pointer auf einen schmalen null-terminierten String Identifizierung des C locale nach dem Anwenden der Änderungen, falls vorhanden, oder NULL-Zeiger bei Ausfall .
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.

[Bearbeiten] Notes

Während Programmstart, das Äquivalent von std::setlocale(LC_ALL, "C"); wird ausgeführt, bevor ein Benutzer Code ausgeführt wird .
Original:
During program startup, the equivalent of std::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.
Obwohl der Rückgabetyp ist char*, Änderung der spitzen-to-Zeichen ist undefiniert .
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.
Weil setlocale verändert globalen Staat, wirkt Ausführung von locale-abhängige Funktionen ist es nicht definiertes Verhalten, um es von einem Thread nennen, während ein anderer Thread ausgeführt wird eine der folgenden Funktionen: std::fprintf, std::isprint, std::iswdigit, std::localeconv, std::tolower, std::fscanf, std::ispunct, std::iswgraph, std::mblen, std::toupper, std::isalnum, std::isspace, std::iswlower, std::mbstowcs, std::towlower, std::isalpha, std::isupper, std::iswprint, std::mbtowc, std::towupper, std::isblank, std::iswalnum, std::iswpunct, std::setlocale, std::wcscoll, std::iscntrl, std::iswalpha, std::iswspace, std::strcoll, std::wcstod, std::isdigit, std::iswblank, std::iswupper, std::strerror, std::wcstombs, std::isgraph, std::iswcntrl, std::iswxdigit, std::strtod, std::wcsxfrm, std::islower, std::iswctype, std::isxdigit .
Original:
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[Bearbeiten] Beispiel

#include <cstdio>
#include <clocale>
#include <ctime>
#include <cwchar>
 
int main()
{
    // the C locale will be UTF-8 enabled English;
    // decimal dot will be German
    // date and time formatting will be Japanese
    std::setlocale(LC_ALL, "en_US.UTF-8");
    std::setlocale(LC_NUMERIC, "de_DE");
    std::setlocale(LC_TIME, "ja_JP");
 
    wchar_t str[100];
    std::time_t t = std::time(NULL);
    std::wcsftime(str, 100, L"%A %c", std::localtime(&t));
    std::wprintf(L"Number: %.2f\nDate: %Ls\n", 3.14, str);
}

Output:

Number: 3,14
Date: 月曜日 2011年12月19日 18時04分40秒

[Bearbeiten] Siehe auch

locale Kategorien für std::setlocale
Original:
locale categories for std::setlocale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Makro konstant) [edit]
eingestellt von polymorphen Facetten, die kulturellen Unterschiede zu kapseln
Original:
set of polymorphic facets that encapsulate cultural differences
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(Klasse) [edit]
C documentation for setlocale