NAME
uselocale
—
select the locale for the current
thread
SYNOPSIS
#include
<locale.h>
locale_t
uselocale
(locale_t newloc);
DESCRIPTION
The function
uselocale
()
selects newloc for use by functions in the current
thread that do not take a locale_t argument. Neither
the global locale set by setlocale(3) nor locales used by other threads change.
The current thread uses
newloc until
uselocale
()
is called again successfully with a non-null argument in the same thread,
and passing newloc to
freelocale(3) or
newlocale(3) before that
results in undefined behaviour.
To revoke the use of newloc
in the current thread without installing another thread-specific locale,
instead reverting to the global locale, call
uselocale
()
with the special argument LC_GLOBAL_LOCALE
.
When called with the argument (locale_t)0, the thread-specific locale remains unchanged.
RETURN VALUES
The function uselocale
() returns the
thread-specific locale which is in use right before the call, or the special
return value LC_GLOBAL_LOCALE
if the thread used the
global locale before the call.
ERRORS
The function uselocale
() fails if:
- [
EINVAL
] - The newloc argument is neither a valid locale object nor (locale_t)0.
SEE ALSO
iswalnum(3), iswctype(3), newlocale(3), towctrans(3), towlower(3), wcscasecmp(3), wctrans(3), wctype(3)
STANDARDS
The function uselocale
() conforms to
IEEE Std 1003.1-2008 (“POSIX.1”).
HISTORY
The function uselocale
() has been
available since OpenBSD 6.2.