localeconv
Gets detailed information on locale settings.
structlconv*localeconv(void);
Routine | Required Header | Compatibility |
localeconv | <locale.h> | ANSI, Win 95, Win NT |
For additional compatibility information, see Compatibility in the Introduction.
Libraries
LIBC.LIB | Single thread static library, retail version |
LIBCMT.LIB | Multithread static library, retail version |
MSVCRT.LIB | Import library for MSVCRT.DLL, retail version |
Return Value
localeconv returns a pointer to a filled-in object of type struct lconv. The values contained in the object can be overwritten by subsequent calls to localeconv and do not directly modify the object. Calls to setlocale with category values of LC_ALL, LC_MONETARY, or LC_NUMERIC overwrite the contents of the structure.
Remarks
The localeconv function gets detailed information about numeric formatting for the current locale. This information is stored in a structure of type lconv. The lconv structure, defined in LOCALE.H, contains the following members:
char *decimal_point
Decimal-point character for nonmonetary quantities.
char *thousands_sep
Character that separates groups of digits to left of decimal point for nonmonetary quantities.
char *grouping
Size of each group of digits in nonmonetary quantities.
char *int_curr_symbol
International currency symbol for current locale. First three characters specify alphabetic international currency symbol as defined in the ISO 4217 Codes for the Representation ofCurrency and Funds standard. Fourth character (immediately preceding null character) separates international currency symbol from monetary quantity.
char *currency_symbol
Local currency symbol for current locale.
char *mon_decimal_point
Decimal-point character for monetary quantities.
char *mon_thousands_sep
Separator for groups of digits to left of decimal place in monetary quantities.
char *mon_grouping
Size of each group of digits in monetary quantities.
char *positive_sign
String denoting sign for nonnegative monetary quantities.
char *negative_sign
String denoting sign for negative monetary quantities.
char int_frac_digits
Number of digits to right of decimal point in internationally formatted monetary quantities.
char frac_digits
Number of digits to right of decimal point in formatted monetary quantities.
char p_cs_precedes
Set to 1 if currency symbol precedes value for nonnegative formatted monetary quantity. Set to 0 if symbol follows value.
char p_sep_by_space
Set to 1 if currency symbol is separated by space from value for nonnegative formatted monetary quantity. Set to 0 if there is no space separation.
char n_cs_precedes
Set to 1 if currency symbol precedes value for negative formatted monetary quantity. Set to 0 if symbol succeeds value.
char n_sep_by_space
Set to 1 if currency symbol is separated by space from value for negative formatted monetary quantity. Set to 0 if there is no space separation.
char p_sign_posn
Position of positive sign in nonnegative formatted monetary quantities.
char n_sign_posn
Position of positive sign in negative formatted monetary quantities.
The char* members of the structure are pointers to strings. Any of these (other than char *decimal_point) that equals "" is either of zero length or is not supported in the current locale. The char members of the structure are nonnegative numbers. Any of these that equals CHAR_MAX is not supported in the current locale.
The elements of grouping and mon_grouping are interpreted according to the following rules.
CHAR_MAX
Do not perform any further grouping.
0
Use previous element for each of remaining digits.
n
Number of digits that make up current group. Next element is examined to determine size of next group of digits before current group.
The values for int_curr_symbol are interpreted according to the following rules:
The first three characters specify the alphabetic international currency symbol as defined in the ISO 4217 Codes for the Representation of Currency and Funds standard.
The fourth character (immediately preceding the null character) separates the international currency symbol from the monetary quantity.
The values for p_cs_precedes and n_cs_precedes are interpreted according to the following rules (the n_cs_precedes rule is in parentheses):
0
Currency symbol follows value for nonnegative (negative) formatted monetary value.
1
Currency symbol precedes value for nonnegative (negative) formatted monetary value.
The values for p_sep_by_space and n_sep_by_space are interpreted according to the following rules (the n_sep_by_space rule is in parentheses):
0
Currency symbol is separated from value by space for nonnegative (negative) formatted monetary value.
1
There is no space separation between currency symbol and value for nonnegative (negative) formatted monetary value.
The values for p_sign_posn and n_sign_posn are interpreted according to the following rules:
0
Parentheses surround quantity and currency symbol
1
Sign string precedes quantity and currency symbol
2
Sign string follows quantity and currency symbol
3
Sign string immediately precedes currency symbol
4
Sign string immediately follows currency symbol
See Also setlocale, strcoll Functions, strftime, strxfrm