Gets detailed information on locale settings.
#include <locale.h>
struct lconv *localeconv( void );
The localeconv function gets detailed information on the locale-specific settings for numeric formatting of the program's current locale. This information is stored in a structure of type lconv.
The lconv structure, defined in LOCALE.H, contains the following members:
Member | Description |
char *decimal_point | Decimal-point character for nonmonetary quantities. |
char *thousands_sep | Character used to separate groups of digits to the left of the decimal point for nonmonetary quantities. |
char *grouping | Size of each group of digits in nonmonetary quantities. |
char *int_curr_symbol | International currency symbol for the current locale. 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) is used to separate the international currency symbol from the monetary quantity. |
char *currency_symbol | Local currency symbol for the current locale. |
char *mon_decimal_point | Decimal-point character for monetary quantities. |
char *mon_thousands_sep | Separator for groups of digits to the left of the 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 the right of the decimal point in internationally formatted monetary quantities. |
char frac_digits | Number of digits to the right of the decimal point in formatted monetary quantities. |
char p_cs_precedes | Set to 1 if the currency symbol precedes the value for a nonnegative formatted monetary quantity. Set to 0 if the symbol follows the value. |
char p_sep_by_space | Set to 1 if the currency symbol is separated by a space from the value for a nonnegative formatted monetary quantity. Set to 0 if there is no space separation. |
char n_cs_precedes | Set to 1 if the currency symbol precedes the value for a negative formatted monetary quantity. Set to 0 if the symbol succeeds the value. |
char n_sep_by_space | Set to 1 if the currency symbol is separated by a space from the value for a 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 struct 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 struct 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:
Value | Interpretation |
CHAR_MAX | No further grouping is to be performed. |
0 | The previous element is to be repeatedly used for the remainder of the digits. |
n | The integer value n is the number of digits that make up the current group. The next element is examined to determine the size of the next group of digits before the current group. |
The values for p_sign_posn and n_sign_posn are interpreted according to the following rules:
Value | Interpretation |
0 | Parentheses surround the quantity and currency symbol |
1 | Sign string precedes the quantity and currency symbol |
2 | Sign string follows the quantity and currency symbol |
3 | Sign string immediately precedes the currency symbol |
4 | Sign string immediately follows the currency symbol |
The localeconv function returns a pointer to a filled in object of type struct lconv. The values contained in the object can be overwritten by susequent calls to localeconv and do not directly modify the object. Calls to the setlocale function with category values of LC_ALL, LC_MONETARY, or LC_NUMERIC will overwrite the contents of the structure.
Standards:ANSI
16-Bit:DOS, QWIN, WIN, WIN DLL
32-Bit:DOS32X