File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed
Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change 55
66``` cpp
77namespace std {
8- char* setlocale(int category, const char* locale);
8+ char* setlocale(int category, const char* locale);
99}
1010```
1111
1212## 概要
1313指定したカテゴリのロケールを設定、または現在のロケールを取得する。
1414
15- 指定できるロケール文字列は[以下のページ ](/article/platform/locales.md)である 。
15+ 指定できる処理系定義のロケール文字列は[使用できるロケール文字列 ](/article/platform/locales.md)を参照のこと 。
1616
1717## 引数
1818- `category`:設定対象のカテゴリ。`LC_ALL`,`LC_CTYPE`などのマクロを使用。
1919- `locale`:
20- * "C":標準のCロケール
21- * "" :環境依存のデフォルトロケール
20+ * ` "C"` :標準のCロケール
21+ * `""` :環境依存のデフォルトロケール
2222 * `NULL`:現在のロケールを取得するだけ
2323
2424## 戻り値
2525成功時は設定されたロケール名(文字列)、失敗時は`NULL`。
2626
27+ 返された文字列をプログラムで変更してはならない。
28+
29+ `setlocale()` を呼び出したスレッドが終了した後、もしくは更に次の `setlocale()` の呼び出しの後に返された文字列を使った時の動作は未定義である。
30+
2731## 例
2832```cpp example
2933#include <iostream>
3034#include <clocale>
3135
32- int main(){
36+ int main() {
3337 // 日本語ロケールに設定
3438 if (!std::setlocale(LC_ALL, "ja_JP.UTF-8")) {
3539 std::cerr << "Failed to set locale\n";
@@ -52,5 +56,5 @@ Numeric locale: ja_JP.UTF-8
5256```
5357
5458## 関連項目
55- - [ ロケール文字一覧 ] ( /article/platform/locales.md )
59+ - [ ロケール文字列一覧 ] ( /article/platform/locales.md )
5660- [ ` std::locale ` ] ( /reference/locale/locale.md )
You can’t perform that action at this time.
0 commit comments