[linux] Re: fprintf met decimale komma

Geert-Jan Hut Geert.Jan.Hut op hutsoftware.nl
Di Mrt 27 23:20:42 CEST 2007


zie de (f)printf manpage:

-------------------

For some numeric conversions a radix character (`decimal point') or 
thousands' grouping character is used. The actual character used depends 
on the LC_NUMERIC part of the locale. The POSIX locale uses `.' as radix 
character, and does not have a grouping character. Thus,

            printf("%'.2f", 1234567.89);

results in `1234567.89' in the POSIX locale, in `1234567,89' in the 
nl_NL locale, and in `1.234.567,89' in the da_DK locale.


      -------------------

Misschien overbodig, maar de locale kan gezet worden door setlocale() - 
gedefinieerd in locale.h - aan te roepen.

Succes ermee,

Groet, Geert-Jan.


Wybo Dekker schreef:
> Weet iemand of het mogelijk is fprintf een komma ipv een punt te laten 
>   produceren, bijvoorbeeld door een omgevingsvariabele te zetten?
>   




More information about the Linux mailing list