1USELOCALE(3)               Linux Programmer's Manual              USELOCALE(3)
2
3
4

NAME

6       uselocale - set/get the locale for the calling thread
7

SYNOPSIS

9       #include <locale.h>
10
11       locale_t uselocale(locale_t newloc);
12
13   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15       uselocale():
16           Since glibc 2.10:
17               _XOPEN_SOURCE >= 700
18           Before glibc 2.10:
19               _GNU_SOURCE
20

DESCRIPTION

22       The  uselocale()  function  sets  the  current  locale  for the calling
23       thread, and returns the thread's previously current  locale.   After  a
24       successful  call  to uselocale(), any calls by this thread to functions
25       that depend on the locale will operate as though the  locale  has  been
26       set to newloc.
27
28       The newloc argument can have one of the following values:
29
30       A handle returned by a call to newlocale(3) or duplocale(3)
31              The  calling thread's current locale is set to the specified lo‐
32              cale.
33
34       The special locale object handle LC_GLOBAL_LOCALE
35              The calling thread's current locale is set to the global  locale
36              determined by setlocale(3).
37
38       (locale_t) 0
39              The  calling  thread's current locale is left unchanged (and the
40              current locale is returned as the function result).
41

RETURN VALUE

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

ERRORS

49       EINVAL newloc does not refer to a valid locale object.
50

VERSIONS

52       The uselocale() function first appeared in version 2.3 of the GNU C li‐
53       brary.
54

CONFORMING TO

56       POSIX.1-2008.
57

NOTES

59       Unlike setlocale(3), uselocale() does not allow  selective  replacement
60       of  individual  locale  categories.  To employ a locale that differs in
61       only a few categories from the current  locale,  use  calls  to  duplo‐
62       cale(3)  and  newlocale(3)  to obtain a locale object equivalent to the
63       current locale and modify the desired categories in that object.
64

EXAMPLES

66       See newlocale(3) and duplocale(3).
67

SEE ALSO

69       locale(1), duplocale(3), freelocale(3), newlocale(3), setlocale(3), lo‐
70       cale(5), locale(7)
71

COLOPHON

73       This  page  is  part of release 5.13 of the Linux man-pages project.  A
74       description of the project, information about reporting bugs,  and  the
75       latest     version     of     this    page,    can    be    found    at
76       https://www.kernel.org/doc/man-pages/.
77
78
79
80Linux                             2021-03-22                      USELOCALE(3)
Impressum