setlocale
- Updated2023-02-21
- 2 minute(s) read
setlocale
char *setlocale (int category, const char locale[]);
Purpose
Modifies the specified category of the program's locale. This function may be used to change or query a category or the program's entire locale. To query the locale, enter NULL into the locale parameter.
At this time, there are only two implemented locales, the C locale, which takes effect when program execution begins, and the default locale, which is an environment's default locale. For example, in Windows, the default locale uses settings from the Control Panel for the following categories:
- Time formatting
- Collation functions
- Numeric formatting
- Character functions
You can set the locale to the C locale by entering "C" into locale. You can set the locale to the default locale by entering an empty string ("") into locale. Entering any other argument will cause NULL to be returned.
Parameters
Input | |||||||||||||||||||||||
Name | Type | Description | |||||||||||||||||||||
category | int |
Specifies the portion of a program's locale to modify. The following gives a description of the selections:
|
|||||||||||||||||||||
locale | const char [] | Specifies the desired locale to implement. Entering NULL causes the program's current locale to be returned. |
Return Value
Name | Type | Description | ||
newLocale | char * |
Contains the string returned by the function. If locale is non-NULL and can be
honored, a pointer to the string associated with the specified category is returned. If the All Categories setting
is selected, then the strings contain a concatenation of the locales for the different categories.
If the selection cannot be honored, the function returns a NULL pointer and the program's locale remains unchanged.
|
Additional Information
Library: ANSI C Library
Include file: ansi_c.h
LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later