INtime SDK Help

Sets the thread's current entire locale or specified portions of it.

#include <locale.h>
char *setlocale (int category, const char *locale);


Specifies which portion of a thread's locale information to use.
Pointer to a string containing the name of the locale for which certain aspects of your program can be customized. C specifies the minimal ANSI-conforming locale for C translation. If locale points to an empty string, the locale is the implementation-defined native locale.


Some locale-dependent aspects include the formatting of dates and the display format for monetary values.

These are the manifest constants used for the category argument and the parts of the program affected:

Value Program parts affected
LC_ALL All categories listed below.
LC_COLLATE strcoll and strxfrm.
LC_CTYPE The character-handling functions except for isdigit and isxdigit, which are unaffected.
LC_MONETARY Monetary formatting information returned by localeconv.
LC_NUMERIC Decimal point character for the formatted output functions such as printf, for the data conversion functions, and for the nonmonetary formatting information returned by localeconv.
LC_TIME strftime.

Return Values

One of these:

  • A pointer to the string associated with the specified category for the new locale. Use the pointer in subsequent calls to restore that part of the program's locale information. Later calls to setlocale will overwrite the string.
  • A pointer to the string associated with the category of the program's locale. It does not change the program's current locale setting if the locale argument is a null pointer.
  • A null pointer. It does not change the program's current locale settings if the locale or category is invalid.


Versions Defined in Include Link to
INtime 3.0 intime/rt/include/locale.h locale.h clib.lib

See Also

localeconv, printf, strcoll, strftime, strxfrm