22<feed xmlns =" http://www.w3.org/2005/Atom" >
33 <title >cpprefjp - C++日本語リファレンス</title >
44 <link href =" https://cpprefjp.github.io" />
5- <updated >2025-12-03T13:53:45.469055 </updated >
6- <id >d31c2584-8090-4178-99d0-94e5ebadb5c2 </id >
5+ <updated >2025-12-03T15:31:46.489385 </updated >
6+ <id >852af33b-46ed-4038-942b-c88e558e41e1 </id >
77
88
9+ <entry >
10+ <title >setlocale -- 指摘された点を変更</title >
11+ <link href =" https://cpprefjp.github.io/reference/clocale/setlocale.html" />
12+ <id >1cf31acb644fd3585d103572247dc2f8bbb36ef9:reference/clocale/setlocale.md</id >
13+ <updated >2025-12-04T00:13:16+09:00</updated >
14+
15+ <summary type =" html" >< pre>< code> diff --git a/reference/clocale/setlocale.md b/reference/clocale/setlocale.md
16+ index e2934913f..2fe7636c1 100644
17+ --- a/reference/clocale/setlocale.md
18+ +++ b/reference/clocale/setlocale.md
19+ @@ -5,31 +5,35 @@
20+
21+ ```cpp
22+ namespace std {
23+ - char* setlocale(int category, const char* locale);
24+ + char* setlocale(int category, const char* locale);
25+ }
26+ ```
27+
28+ ## 概要
29+ 指定したカテゴリのロケールを設定、または現在のロケールを取得する。
30+
31+ -指定できるロケール文字列は[以下のページ](/article/platform/locales.md)である。
32+ +指定できる処理系定義のロケール文字列は[使用できるロケール文字列](/article/platform/locales.md)を参照のこと。
33+
34+ ## 引数
35+ - `category`:設定対象のカテゴリ。`LC_ALL`,`LC_CTYPE`などのマクロを使用。
36+ - `locale`:
37+ - * & #34;C& #34;:標準のCロケール
38+ - * & #34;& #34;:環境依存のデフォルトロケール
39+ + * `& #34;C& #34;`:標準のCロケール
40+ + * `& #34;& #34;`:環境依存のデフォルトロケール
41+ * `NULL`:現在のロケールを取得するだけ
42+
43+ ## 戻り値
44+ 成功時は設定されたロケール名(文字列)、失敗時は`NULL`。
45+
46+ +返された文字列をプログラムで変更してはならない。
47+ +
48+ +`setlocale()` を呼び出したスレッドが終了した後、もしくは更に次の `setlocale()` の呼び出しの後に返された文字列を使った時の動作は未定義である。
49+ +
50+ ## 例
51+ ```cpp example
52+ #include & lt;iostream& gt;
53+ #include & lt;clocale& gt;
54+
55+ -int main(){
56+ +int main() {
57+ // 日本語ロケールに設定
58+ if (!std::setlocale(LC_ALL, & #34;ja_JP.UTF-8& #34;)) {
59+ std::cerr & lt;& lt; & #34;Failed to set locale\n& #34;;
60+ @@ -52,5 +56,5 @@ Numeric locale: ja_JP.UTF-8
61+ ```
62+
63+ ## 関連項目
64+ -- [ ロケール文字一覧 ](/article/platform/locales.md)
65+ +- [ ロケール文字列一覧 ](/article/platform/locales.md)
66+ - [ `std::locale` ](/reference/locale/locale.md)
67+ < /code>< /pre> </summary >
68+
69+ <author >
70+ <name >K10-K10</name >
71+ <email >keito.tottori@gmail.com</email >
72+ </author >
73+ </entry >
74+
975 <entry >
1076 <title >clocale -- setlocaleへのパスを追加</title >
1177 <link href =" https://cpprefjp.github.io/reference/clocale.html" />
@@ -1417,39 +1483,4 @@ index 000000000..e2934913f
14171483 </author >
14181484 </entry >
14191485
1420- <entry >
1421- <title >mblen -- mblenのサンプルコード : ロケールを毎回設定すると重いので文字数計算の外にだした</title >
1422- <link href =" https://cpprefjp.github.io/reference/cstdlib/mblen.html" />
1423- <id >0b61755bd12efe68418cb790b84cf00cd8667ea5:reference/cstdlib/mblen.md</id >
1424- <updated >2025-12-03T10:11:53+09:00</updated >
1425-
1426- <summary type =" html" >< pre>< code> diff --git a/reference/cstdlib/mblen.md b/reference/cstdlib/mblen.md
1427- index 838ee668b..4cdcd924d 100644
1428- --- a/reference/cstdlib/mblen.md
1429- +++ b/reference/cstdlib/mblen.md
1430- @@ -51,7 +51,6 @@ int main() {
1431- #include & lt;clocale& gt;
1432-
1433- int count_chars_mblen(const char* s) {
1434- - std::setlocale(LC_ALL, & #34;ja_JP.UTF-8& #34;);
1435- int count = 0;
1436- size_t i = 0;
1437- while (s[i] != & #39;\0& #39;) {
1438- @@ -66,6 +65,8 @@ int count_chars_mblen(const char* s) {
1439- }
1440-
1441- int main() {
1442- + std::setlocale(LC_ALL, & #34;ja_JP.UTF-8& #34;);
1443- +
1444- const char* str = & #34;こんにちは世界& #34;;
1445- std::cout & lt;& lt; & #34;文字列: & #34; & lt;& lt; str & lt;& lt; & #34;\n& #34;;
1446- std::cout & lt;& lt; & #34;文字数: & #34; & lt;& lt; count_chars_mblen(str) & lt;& lt; & #34;\n& #34;;
1447- < /code>< /pre> </summary >
1448-
1449- <author >
1450- <name >Akira Takahashi</name >
1451- <email >faithandbrave@gmail.com</email >
1452- </author >
1453- </entry >
1454-
14551486</feed >
0 commit comments