名前空間
変種
操作

LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, LC_TIME

提供: cppreference.com
< c‎ | locale

 
 
ローカリゼーションサポート
setlocale
localeconv
lconv
ロケールのカテゴリを設定することが必要であること
Original:
Locale categories
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
LC_ALL
LC_COLLATE
LC_CTYPE
LC_MONETARY
LC_NUMERIC
LC_TIME
 
Defined in header <locale.h>
#define LC_ALL      /*implementation defined*/
#define LC_COLLATE  /*implementation defined*/
#define LC_CTYPE    /*implementation defined*/
#define LC_MONETARY /*implementation defined*/
#define LC_NUMERIC  /*implementation defined*/
#define LC_TIME     /*implementation defined*/
上記のマクロの各定数はsetlocaleの最初の引数として使用するのに適した個別の値を持つ整数定数式に展開.
Original:
Each of the above macro constants expand to integer constant expressions with distinct values that are suitable for use as the first argument of setlocale.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
定数
Original:
Constant
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Explanation
LC_ALL
全体のCロケールを選択します
Original:
selects the entire C locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
LC_COLLATE
Cのロケールの照合順序カテゴリを選択します
Original:
selects the collation category of the C locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
LC_CTYPE
Cロケールの文字分類カテゴリを選択します
Original:
selects the character classification category of the C locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
LC_MONETARY
Cロケールの通貨形式カテゴリを選択します
Original:
selects the monetary formatting category of the C locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
LC_NUMERIC
Cのロケールの数値形式カテゴリを選択します
Original:
selects the numeric formatting category of the C locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
LC_TIME
Cのロケールの時刻形式カテゴリーを選択します
Original:
selects the time formatting category of the C locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
LC_で始まる名前の追加のマクロ定数は、locale.hで定義されるかもしれない、少なくともひとつの大文字が続く。たとえば、POSIX仕様は、LC_MESSAGESを必要とし、GNU CライブラリはさらにLC_PAPER、LC_NAME、LC_ADDRESS、LC_TELEPHONE、LC_MEASUREMENT、とLC_IDENTIFICATIONを定義しています.
Original:
Additional macro constants, with names that begin with LC_ followed by at least one uppercase letter, may be defined in locale.h. For example, the POSIX specification requires LC_MESSAGES and the GNU C library additionally defines LC_PAPER, LC_NAME, LC_ADDRESS, LC_TELEPHONE, LC_MEASUREMENT, and LC_IDENTIFICATION.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[編集]

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

Output:

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

[編集] も参照してください

現在のCロケールを取得し、設定します
Original:
gets and sets the current C locale
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

(機能) [edit]
C++ documentation for locale categories