LabWindows/CVI

Content Type
Programming Language
Current manual
Table of Contents

setlocale

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:
Category Value (int) Description
All Categories LC_All (0) Modify program's entire locale
Collation Functions LC_COLLATE (1) Change locale for strcoll and strxfrm
Character Functions LC_CTYPE (2) Change locale for the character handling and multibyte functions
Monetary Formatting LC_MONETARY (3) Change locale for monetary formatting
Numeric Formatting LC_NUMERIC (4) Change locale for numeric formatting
Time Formatting LC_TIME (5) Change locale for strftime
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.
Note Note  If you just want to get the string for the current locale, pass NULL in locale.

Additional Information

Library: ANSI C Library

Include file: ansi_c.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Was this information helpful?

Previous

setjmp

Previous

setjmp