.\" Copyright (C) 2014 Michael Kerrisk .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH USELOCALE 3 2020\-06\-09 Linux "Linux Programmer's Manual" .SH 名前 setlocale \- 現在のスレッドのロケール (locale) を設定/取得する .SH 書式 .nf \fB#include \fP .PP \fBlocale_t uselocale(locale_t \fP\fInewloc\fP\fB);\fP .fi .PP .RS -4 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .RE .PP \fBuselocale\fP(): .PD 0 .RS 4 .TP glibc 2.10 以降: _XOPEN_SOURCE\ >=\ 700 .TP glibc 2.10 より前: _GNU_SOURCE .RE .PD .SH 説明 \fBuselocale\fP() 関数は呼び出し元スレッドの現在のロケールを設定し、 そのスレッドの現在のロケールの直前の値を返す。 \fBuselocale\fP() の呼び出しが成功した後は、 ロケールに依存する関数のこのスレッドによる呼び出しは \fInewloc\fP で設定されたロケールで動作する。 .PP \fInewloc\fP 引数には以下の値のいずれかを指定できる。 .TP \fBnewlocale\fP(3) か \fBduplocale\fP(3) の呼び出しで返されたハンドル 呼び出し元スレッドの現在のロケールを指定したロケールに設定する。 .TP 特別な値のロケールオブジェクトハンドル \fBLC_GLOBAL_LOCALE\fP 呼び出し元スレッドの現在のロケールを \fBsetlocale\fP(3) で決定されるグローバルロケールに設定する。 .TP \fI(locale_t) 0\fP 呼び出し元スレッドの現在のロケールは変更されないままである (関数呼び出しの結果として現在のロケールが返される)。 .SH 返り値 On success, \fBuselocale\fP() returns the locale handle that was set by the previous call to \fBuselocale\fP() in this thread, or \fBLC_GLOBAL_LOCALE\fP if there was no such previous call. On error, it returns \fI(locale_t)\ 0\fP, and sets \fIerrno\fP to indicate the cause of the error. .SH エラー .TP \fBEINVAL\fP \fInewloc\fP が有効なロケールオブジェクトを参照していない。 .SH バージョン \fBuselocale\fP() 関数は GNU C ライブラリのバージョン 2.3 で初めて登場した。 .SH 準拠 POSIX.1\-2008. .SH 注意 \fBsetlocale\fP(3) と異なり、 \fBuselocale\fP() では特定のロケールカテゴリーだけを指定して置き換えることはできない。 いくつかのカテゴリーだけで現在のロケールとは異なるカテゴリーを利用するには、 \fBduplocale\fP(3) と \fBnewlocale\fP(3) を呼び出して、 現在のロケールと等価なロケールオブジェクトを取得し、 そのオブジェクトの所望のカテゴリーを変更する必要がある。 .SH 例 \fBnewlocale\fP(3) と \fBduplocale\fP(3) を参照。 .SH 関連項目 \fBlocale\fP(1), \fBduplocale\fP(3), \fBfreelocale\fP(3), \fBnewlocale\fP(3), \fBsetlocale\fP(3), \fBlocale\fP(5), \fBlocale\fP(7) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。