Skip to content

Instantly share code, notes, and snippets.

@korli
Created July 23, 2017 11:43
Show Gist options
  • Save korli/fd910c63a90a0cedb360a11e94198c4c to your computer and use it in GitHub Desktop.
Save korli/fd910c63a90a0cedb360a11e94198c4c to your computer and use it in GitHub Desktop.
localeconv example
#include <locale.h>
#include <stdio.h>
int main ()
{
struct lconv * lc;
setlocale(LC_ALL, "de_DE.UTF-8");
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);
setlocale(LC_ALL, "it_IT.UTF-8");
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);
setlocale(LC_ALL, "fr_FR.UTF-8");
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);
setlocale(LC_ALL, "en_US.UTF-8");
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);
setlocale(LC_ALL, "en_GB.UTF-8");
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment