C/C++ CString.Format

Sep 29, 2004
18,656
68
91
I have the following line of code:

someCString.Format("%.1f", someDouble);

I am getting a formatted string of "1.$". Why is this so?
 

sao123

Lifer
May 27, 2002
12,653
205
106
Originally posted by: IHateMyJob2004
I have the following line of code:

someCString.Format("%.1f", someDouble);

I am getting a formatted string of "1.$". Why is this so?


You are requesting a to convert a floating point with 1 significant digit into a string... but you are feeding it a double type.

 
Sep 29, 2004
18,656
68
91
Originally posted by: sao123
Originally posted by: IHateMyJob2004
I have the following line of code:

someCString.Format("%.1f", someDouble);

I am getting a formatted string of "1.$". Why is this so?


You are requesting a to convert a floating point with 1 significant digit into a string... but you are feeding it a double type.

This works. I did find that we were accidentally passing in infinity as the arugment, thus the 1.$.