10.4 Using the setlocale Function to Set Up an International Environment

An application sets up its international environment at run-time by calling the setlocale function. The international environment is set up in one of two ways:

The syntax for the setlocale function is:

char *setlocale(int category, const char *locale)

Where:

If an application does not call the setlocale function, the default locale is the C locale. This allows such applications to call those functions that use information in the current locale.

Specifying the Locale Using Logical Names

If the setlocale function is called with "" as the locale argument, the function checks for a number of logical names to determine the locale name for the category specified.

There are a number of logical names that users can set up to define their international environment:

In addition to the logical names defined by a user, there are a number of system-wide logical names, set up during system startup, that define the default international environment for all users on a system:

The setlocale function checks for user-defined logical names first, and if these are not defined, it checks the system logical names.


Previous Page | Next Page | Table of Contents | Index