1USELOCALE(3P)              POSIX Programmer's Manual             USELOCALE(3P)
2
3
4

PROLOG

6       This  manual  page is part of the POSIX Programmer's Manual.  The Linux
7       implementation of this interface may differ (consult the  corresponding
8       Linux  manual page for details of Linux behavior), or the interface may
9       not be implemented on Linux.
10

NAME

12       uselocale — use locale in current thread
13

SYNOPSIS

15       #include <locale.h>
16
17       locale_t uselocale(locale_t newloc);
18

DESCRIPTION

20       The uselocale() function shall set or query the current locale for  the
21       calling thread.
22
23       The value for the newloc argument shall be one of the following:
24
25        1. A value returned by the newlocale() or duplocale() functions
26
27        2. The special locale object descriptor LC_GLOBAL_LOCALE
28
29        3. (locale_t)0
30
31       If  the newloc argument is (locale_t)0, the current locale shall not be
32       changed; this value can be used to query the current locale setting. If
33       the  newloc  argument  is LC_GLOBAL_LOCALE, any thread-local locale for
34       the calling thread shall be uninstalled; the thread shall again use the
35       global  locale  as the current locale, and changes to the global locale
36       shall affect the thread. Otherwise, the locale  represented  by  newloc
37       shall  be  installed as a thread-local locale to be used as the current
38       locale for the calling thread.
39
40       Once the uselocale() function has been called to install a thread-local
41       locale,  the  behavior  of  every interface using data from the current
42       locale shall be affected for the calling thread. The current locale for
43       other threads shall remain unchanged.
44

RETURN VALUE

46       Upon  successful  completion,  the  uselocale() function shall return a
47       handle for the thread-local locale that  was  in  use  as  the  current
48       locale   for   the   calling  thread  on  entry  to  the  function,  or
49       LC_GLOBAL_LOCALE if no thread-local locale was in use. Otherwise,  use‐
50       locale() shall return (locale_t)0 and set errno to indicate the error.
51

ERRORS

53       The uselocale() function may fail if:
54
55       EINVAL newloc is not a valid locale object and is not (locale_t)0.
56
57       The following sections are informative.
58

EXAMPLES

60       None.
61

APPLICATION USAGE

63       Unlike  the  setlocale()  function,  the  uselocale() function does not
64       allow replacing some locale categories only. Applications that need  to
65       install a locale which differs only in a few categories must use newlo‐
66       cale() to change a locale  object  equivalent  to  the  currently  used
67       locale and install it.
68

RATIONALE

70       None.
71

FUTURE DIRECTIONS

73       None.
74

SEE ALSO

76       duplocale(), freelocale(), newlocale(), setlocale()
77
78       The Base Definitions volume of POSIX.1‐2017, <locale.h>
79
81       Portions  of  this text are reprinted and reproduced in electronic form
82       from IEEE Std 1003.1-2017, Standard for Information Technology --  Por‐
83       table  Operating System Interface (POSIX), The Open Group Base Specifi‐
84       cations Issue 7, 2018 Edition, Copyright (C) 2018 by the  Institute  of
85       Electrical  and  Electronics Engineers, Inc and The Open Group.  In the
86       event of any discrepancy between this version and the original IEEE and
87       The  Open Group Standard, the original IEEE and The Open Group Standard
88       is the referee document. The original Standard can be  obtained  online
89       at http://www.opengroup.org/unix/online.html .
90
91       Any  typographical  or  formatting  errors that appear in this page are
92       most likely to have been introduced during the conversion of the source
93       files  to  man page format. To report such errors, see https://www.ker
94       nel.org/doc/man-pages/reporting_bugs.html .
95
96
97
98IEEE/The Open Group                  2017                        USELOCALE(3P)
Impressum