HP C/iX Library Reference Manual (30026-90004)
Chapter 5 307
HP C/iX Library Function Descriptions
setlocale
setlocale
Controls locale-specific features of the library.
Syntax
#include <locale.h>
char *setlocale (int
category
, const char *
locale
);
Parameters
category
Specifies that only a certain aspect is to be set to that locale and the others
are unchanged. This parameter can be set to any one of the following
macros (defined in <locale.h>):
• LC_COLLATE
• LC_CTYPE
• LC_MONETARY
• LC_NUMERIC
• LC_TIME
• LC_ALL
locale
Typically the name of a supported language. German, for example, is a
supported language.
Return Values
x A pointer to a string that defines the locale.
NULL The program's locale has not been changed. The request has failed.
Description
The setlocale function controls locale-specific features of the library.
The string returned by setlocale must not be altered and may be overwritten by
subsequent calls to setlocale().
Following is a description of the behavior of setlocale() under four different conditions:
• When in Program Startup
— When a program is started, the locale of the program is the default, C-locale.
• When Locale is Specified
—Iflocale is specified, the named category is set to that locale.
setlocale (LC_ALL, "german");
• When Locale is Not Specified