Re: Currencies list?



Yesterday at 17:41, Murray Cumming wrote:

> - how could I get a translation of a currency name, in the current
> locale?

As for current locale, why not use strfmon or localeconv instead?

#include <monetary.h>
#include <locale.h>

int main(void) {
  char dump[100];
  struct lconv *info;

  setlocale(LC_ALL,"");
  info = localeconv();

  strfmon(dump, 100, "%n", 123.45);
  printf("%s\nint_curr_symbol: %s\ncurrency_symbol: %s\n", dump, info->int_curr_symbol, info->currency_symbol);
  
  return 0;
}

This gives me in sr_CS locale:

123,45 ÐÐÐ
int_curr_symbol: CSD 
currency_symbol: ÐÐÐ

Of course, if you need to list all the currencies and allow user to
select them, then using iso-codes is likely much better.

Cheers,
Danilo


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]