使用例
|
#include <stdio.h>
#include <locale.h>
static void print_lconv();
int main(void)
{
setlocale(LC_ALL, "");
print_lconv();
setlocale(LC_ALL, "spanish");
print_lconv();
}
void print_lconv()
{
const struct lconv* lc = localeconv();
printf("--- %s ---\n", setlocale(LC_ALL, NULL));
printf("decimal_point == %s\n", lc->decimal_point);
printf("thousands_sep == %s\n", lc->thousands_sep);
printf("grouping == %s\n", lc->grouping);
printf("int_curr_symbol == %s\n", lc->int_curr_symbol);
printf("currency_symbol == %s\n", lc->currency_symbol);
printf("mon_decimal_point == %s\n", lc->mon_decimal_point);
printf("mon_thousands_sep == %s\n", lc->mon_thousands_sep);
printf("mon_grouping == %s\n", lc->mon_grouping);
printf("positive_sign == %s\n", lc->positive_sign);
printf("negative_sign == %s\n", lc->negative_sign);
printf("int_frac_digits == %c\n", lc->int_frac_digits);
printf("frac_digits == %c\n", lc->frac_digits);
printf("p_cs_precedes == %c\n", lc->p_cs_precedes);
printf("p_sep_by_space == %c\n", lc->p_sep_by_space);
printf("n_cs_precedes == %c\n", lc->n_cs_precedes);
printf("n_sep_by_space == %c\n", lc->n_sep_by_space);
printf("p_sign_posn == %c\n", lc->p_sign_posn);
printf("n_sign_posn == %c\n", lc->n_sign_posn);
printf("\n\n");
}
実行結果:
--- Japanese_Japan.932 ---
decimal_point == .
thousands_sep == ,
grouping ==
int_curr_symbol == JPY
currency_symbol == \
mon_decimal_point == .
mon_thousands_sep == ,
mon_grouping ==
positive_sign ==
negative_sign == -
int_frac_digits ==
frac_digits ==
p_cs_precedes ==
p_sep_by_space ==
n_cs_precedes ==
n_sep_by_space ==
p_sign_posn ==
n_sign_posn ==
--- Spanish_Spain.1252 ---
decimal_point == ,
thousands_sep == .
grouping ==
int_curr_symbol == EUR
currency_symbol == ?
mon_decimal_point == ,
mon_thousands_sep == .
mon_grouping ==
positive_sign ==
negative_sign == -
int_frac_digits ==
frac_digits ==
p_cs_precedes ==
|