uselocale

Section: C Library Functions (3)
Updated: 2026-02-08
Index JM Home Page roff page
 

名前

setlocale - 現在のスレッドのロケール (locale) を設定/取得する  

ライブラリ

標準 C ライブラリ (libc,~-lc)  

書式

#include <locale.h>

locale_t uselocale(locale_t newloc);

glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):

uselocale():

    Since glibc 2.10:
        _XOPEN_SOURCE >= 700
    Before glibc 2.10:
        _GNU_SOURCE
 

説明

uselocale() 関数は呼び出し元スレッドの現在のロケールを設定し、 そのスレッドの現在のロケールの直前の値を返す。 uselocale() の呼び出しが成功した後は、 ロケールに依存する関数のこのスレッドによる呼び出しは newloc で設定されたロケールで動作する。

newloc 引数には以下の値のいずれかを指定できる。

A handle returned by a call to
newlocale(3) or duplocale(3) The calling thread's current locale is set to the specified locale.
The special locale object handle
LC_GLOBAL_LOCALE The calling thread's current locale is set to the global locale determined by setlocale(3).
(locale_t) 0
呼び出し元スレッドの現在のロケールは変更されないままである (関数呼び出しの結果として現在のロケールが返される)。
 

返り値

On success, uselocale() returns the locale handle that was set by the previous call to uselocale() in this thread, or LC_GLOBAL_LOCALE if there was no such previous call. On error, it returns (locale_t) 0, and sets errno to indicate the error.  

エラー

EINVAL
newloc が有効なロケールオブジェクトを参照していない。
 

標準規格

POSIX.1-2008.  

歴史

glibc 2.3. POSIX.1-2008.  

注意

setlocale(3) と異なり、 uselocale() では特定のロケールカテゴリーだけを指定して置き換えることはできない。 いくつかのカテゴリーだけで現在のロケールとは異なるカテゴリーを利用するには、 duplocale(3) と newlocale(3) を呼び出して、 現在のロケールと等価なロケールオブジェクトを取得し、 そのオブジェクトの所望のカテゴリーを変更する必要がある。  

例

newlocale(3) と duplocale(3) を参照。  

関連項目

locale(1), duplocale(3), freelocale(3), newlocale(3), setlocale(3), locale(5), locale(7)


 

Index

名前
ライブラリ
書式
説明
返り値
エラー
標準規格
歴史
注意
例
関連項目

This document was created by man2html, using the manual pages.