setlocale

Selects a portion of a program’s locale

Local Servers:nonblocking
Remote Servers:N/A
NetWare Server:ANSI
Platform:NLM
Service:Internationalization

Syntax

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

Parameters

category
(IN) Specifies the environment category for the specified locale.
locale
(IN) Points to the locale for the program.

Return Values

If the selection is successful, a string is returned to indicate the locale that was in effect before setlocale was called; otherwise, a NULL pointer is returned.

Remarks

setlocale selects a portion of a locale for a program according to the category given by the category parameter and the locale specified by the locale parameter.

A locale affects the collating sequence (the order in which characters compare with one another), the way in which certain character-handling functions operate, the decimal-point character that is used in formatted input/output and string conversion, and the format and names used in the time string produced by the strftime function.

The possible values for the argument category are as follows:

LC_ALL

Select entire environment

LC_COLLATE

Select collating sequence

LC_CTYPE

Select the character handling

LC_NUMERIC

Select the numeric-format environment

LC_TIME

Select the time-related environment

At the start of a program, the equivalent of

     setlocale (LC_ALL, "");
  

is executed.

See Also

localeconv, NWLsetlocale, strftime (NDK: Program Management)