tags:

views:

178

answers:

3

Hi, i'm writing a double value to a file. The numeric value is written with a point as a decimal separator. I would like to use a comma. How i can do that?

A: 
Craig
+2  A: 

You can find the answer in an earlier question This basically changes the locale used by the streams you are using.

Michael Anderson
+3  A: 

The usual way is to use a locale with the decimal separator set to the comma. If your machine is configured for that generally, you can probably just use the nameless locale for it:

std::cout.imbue(std::locale(""));
std::cout << 12345.67;
Jerry Coffin