1uselocale(3)               Library Functions Manual               uselocale(3)
2
3
4

NAME

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

LIBRARY

9       Standard C library (libc, -lc)
10

SYNOPSIS

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

DESCRIPTION

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

RETURN VALUE

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

ERRORS

52       EINVAL newloc does not refer to a valid locale object.
53

STANDARDS

55       POSIX.1-2008.
56

HISTORY

58       glibc 2.3.  POSIX.1-2008.
59

NOTES

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

EXAMPLES

68       See newlocale(3) and duplocale(3).
69

SEE ALSO

71       locale(1), duplocale(3), freelocale(3), newlocale(3), setlocale(3), lo‐
72       cale(5), locale(7)
73
74
75
76Linux man-pages 6.05              2023-03-30                      uselocale(3)
Impressum