Syntax
#include <locale.h> struct lconv *localeconv(void);Description
localeconv retrieves information about the environment for the current locale and places the information in a structure of type struct lconv. Subsequent calls to localeconv, or to setlocale with the argument LC_ALL, LC_MONETARY, or LC_NUMERIC, can overwrite the structure.
The structure contains the members listed below. Pointers to strings with
a value of "" indicate that the value is not available in this locale or
is of zero length. Character types with a value of CHAR_MAX indicate that
the value is not available in this locale. ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ Element ³ Purpose of Element ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char ³ Decimal-point character for formatting ³
³ *decimal_point" ³ nonmonetary quantities. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char ³ Character used to separate groups of ³
³ *thousands_sep" ³ digits to the left of the decimal-point ³
³ ³ character in formatted nonmonetary quan- ³
³ ³ tities. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char *grouping" ³ Size of each group of digits in for- ³
³ ³ matted nonmonetary quantities. The ³
³ ³ value of each character in the string ³
³ ³ determines the number of digits in a ³
³ ³ group. "CHAR_MAX" indicates that there ³
³ ³ are no further groupings. If the last ³
³ ³ integer is not "CHAR_MAX", then the size ³
³ ³ of the previous group will be used for ³
³ ³ the remainder of the digits. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char ³ International currency symbol. The ³
³ *int_curr_symbol" ³ first three characters contain the ³
³ ³ alphabetic international currency ³
³ ³ symbol. The fourth character (usually a ³
³ ³ space) separates the international cur- ³
³ ³ rency symbol from the monetary quantity. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char ³ Local currency symbol. ³
³ *currency_symbol" ³ ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char ³ Decimal-point character for formatting ³
³ *mon_decimal_point" ³ monetary quantities. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char ³ Separator for digits in formatted mone- ³
³ *mon_thousands_sep" ³ tary quantities. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char *mon_grouping" ³ Size of each group of digits in for- ³
³ ³ matted monetary quantities. The value ³
³ ³ of each character in the string deter- ³
³ ³ mines the number of digits in a group. ³
³ ³ "CHAR_MAX" indicates that there are no ³
³ ³ further groupings. If the last integer ³
³ ³ is not "CHAR_MAX", then the size of the ³
³ ³ previous group will be used for the ³
³ ³ remainder of the digits. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char ³ Positive sign used in monetary quanti- ³
³ *positive_sign" ³ ties. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char ³ Negative sign used in monetary quanti- ³
³ *negative_sign" ³ ties. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char ³ Mumber of displayed digits to the right ³
³ int_frac_digits" ³ of the decimal place for internationally ³
³ ³ formatted monetary quantities. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char frac_digits" ³ Number of digits to the right of the ³
³ ³ decimal place in monetary quantities. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char p_cs_precedes" ³ 1 if the "currency_symbol" precedes the ³
³ ³ value for a nonnegative formatted mone- ³
³ ³ tary quantity; "0" if it does not. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char ³ 1 if the "currency_symbol" is separated ³
³ p_sep_by_space" ³ by a space from the value of a nonnega- ³
³ ³ tive formatted monetary quantity; "0" ³
³ ³ if it is not. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char n_cs_precedes" ³ 1 if the "currency_symbol" precedes the ³
³ ³ value for a negative formatted monetary ³
³ ³ quantity; "0" if it does not. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char ³ 1 if the "currency_symbol" is separated ³
³ n_sep_by_space" ³ by a space from the value of a negative ³
³ ³ formatted monetary quantity; "0" if it ³
³ ³ is not. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char p_sign_posn" ³ Position of the "positive_sign" for a ³
³ ³ nonnegative formatted monetary quantity. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char n_sign_posn" ³ Position of the "negative_sign" for a ³
³ ³ negative formatted monetary quantity. ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ "char ³ Symbol to appear to the left of a ³
³ *left_parenthesis" ³ negative-valued monetary symbol (such as ³
³ ³ a loss or deficit). ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char ³ Symbol to appear to the right of a ³
³ *right_parenthesis" ³ negative-valued monetary symbol (such as ³
³ ³ a loss or deficit). ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char *debit_sign" ³ String to indicate a non-negative-valued ³
³ ³ formatted monetary quantity. ³
ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´
³ "char *credit_sign" ³ String to indicate a negative-valued ³
³ ³ formatted monetary quantity. ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
The grouping and mon_grouping members can have the following values:
Value
The n_sign_posn and p_sign_posn elements can have the following values:
Value
This example prints out the default decimal point for your locale and then the decimal point for the Fr_FR.IBM-850 locale.
#include <stdio.h>#include <locale.h> int main(void) { struct lconv *mylocale; mylocale = localeconv(); printf("Default decimal point is a %s\n", mylocale->decimal_point); if (NULL != setlocale(LC_ALL, Fr_FR.IBM-850)) { mylocale = localeconv(); printf("France's decimal point is a %s\n", mylocale->decimal_point); } else { printf("setlocale(LC_ALL, Fr_FR.IBM-850) returned <NULL>\n"); } return 0; /**************************************************************************** The output should be similar to : Default decimal point is a . France's decimal point is a , ****************************************************************************/ }Related Information