funciones de la biblioteca C - localeconv ()
C biblioteca estándar - <locale.h>
descripción
C funciones de bibliotecastruct lconv * localeconv (void) establecer o leer la información local.Devuelve un objeto de tipo estructuralconv.
declaración
Aquí es) a función más localeconv (.
struct lconv *localeconv(void)
parámetros
- NA
Valor de retorno
Esta función devuelve un puntero a unalconv área actual puntero de estructura,que está estructurado de la siguiente manera:
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
Ejemplos
El siguiente ejemplo muestra se utiliza la función localeconv ().
#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; }
Vamos a compilar y ejecutar el programa anterior, lo que resultará en lo siguiente:
Local Currency Symbol: EUR International Currency Symbol: EUR Local Currency Symbol: $ International Currency Symbol: USD Local Currency Symbol: £ International Currency Symbol: GBP Decimal Point = .