English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
C Standard Library - <locale.h>
C Library Function struct lconv *localeconv(void) Sets or reads localization information. It returns a lconv A structure type object.
The following is the declaration of the localeconv() function.
struct lconv *localeconv(void)
NA
This function returns a pointer to a structure of type struct lconv a pointer to a structure, which is defined as follows:
typedef struct { char *decimal_point; char *thousands_sep; char *grouping; char *int_curr_symbol; char *currency_symbol; char *mon_decimal_point; char *mon_thousands_sep; char *mon_grouping; char *positive_sign; char *negative_sign; char int_frac_digits; char frac_digits; char p_cs_precedes; char p_sep_by_space; char n_cs_precedes; char n_sep_by_space; char p_sign_posn; char n_sign_posn; } lconv
The following example demonstrates the usage of the localeconv() function.
#include <locale.h> #include <stdio.h> int main() { struct lconv * lc; setlocale(LC_MONETARY, "it_IT"); lc = localeconv(); printf("Local currency symbol: %s\n", lc->currency_symbol); printf("International currency symbol: %s\n", lc->int_curr_symbol); setlocale(LC_MONETARY, "en_US"); lc = localeconv(); printf("Local currency symbol: %s\n", lc->currency_symbol); printf("International currency symbol: %s\n", lc->int_curr_symbol); setlocale(LC_MONETARY, "en_GB"); lc = localeconv(); printf("Local currency symbol: %s\n", lc->currency_symbol); printf("International currency symbol: %s\n", lc->int_curr_symbol); printf("Decimal point = %s\n", lc->decimal_point); return 0; }
Let's compile and run the above program, which will produce the following result:
Local currency symbol: EUR International currency symbol: EUR Local currency symbol: $ International currency symbol: USD Local currency symbol: £ International currency symbol: GBP Decimal point = .