C / C ++: printf uses commas instead of periods as decimal separator
I need my program to show the result using commas as a decimal separator.
From this link: http://www.java2s.com/Code/Java/Development-Class/Floatingpointwithcommasf.htm you can use something like this in Java:
System.out.printf("Floating-point with commas: %,f\n", 1234567.123);
Is there a flag or something that I can use to have similar behavior in C?
Thanks in advance!
+3
source to share
2 answers
There is C
no similar functionality. You can use sprintf
to print to char array and then replace semicolon manually. I cannot think of a better solution, sorry.
EDIT: Thanks to Matz Patersson: It seems that setting the language might change this character. Please see the link he posted.
+4
source to share