Using the code below sometimes the text variable contains a very huge and strange number, something like "1552505576255083400000000000000000000000000000000000000000000000000000.000". A "0.000" string is expected.
I've also tryed with a basic dialog app and execute these two lines of code in the "OnInitDialog()" I'm using VS 2013. With VS 2003 seems that it works correctly.
can somebody tell me why?
CString text;
text.Format(_T("%.3f"), 0);
Your code has a bug. The
%f
format specifies requires a floating point number and you specify an integer. To fix the bug, change the0
to0.0
.