|
NAMEsetlocale —
natural language formatting for C
LIBRARYStandard C Library (libc, -lc)SYNOPSIS#include <locale.h>
char *
DESCRIPTIONThesetlocale () function sets the C library's notion of
natural language formatting style for particular sets of routines. Each such
style is called a ‘locale’ and is invoked using an appropriate
name passed as a C string.
The
Only three locales are defined by default, the empty string
The option By default, C programs start in the
The only function in the library that sets the locale is
RETURN VALUESUpon successful completion,setlocale () returns the
string associated with the specified category for the
requested locale. The
setlocale () function returns
NULL and fails to change the locale if the given
combination of category and locale
makes no sense.
FILES
EXAMPLESThe following code illustrates how a program can initialize the international environment for one language, while selectively modifying the program's locale such that regular expressions and string operations can be applied to text recorded in a different language:setlocale(LC_ALL, "de"); setlocale(LC_COLLATE, "fr"); When a process is started, its current locale is set to the C or POSIX locale. An internationalized program that depends on locale data not defined in the C or POSIX locale must invoke the setlocale subroutine in the following manner before using any of the locale-specific information: setlocale(LC_ALL, ""); ERRORSNo errors are defined.SEE ALSOlocale(1), localedef(1), catopen(3), ctype(3), localeconv(3), multibyte(3), strcoll(3), strxfrm(3), euc(5), utf8(5), environ(7)STANDARDSThesetlocale () function conforms to
ISO/IEC 9899:1999 (“ISO C99”).
HISTORYThesetlocale () function first appeared in
4.4BSD.
Visit the GSP FreeBSD Man Page Interface. |