I have a float value: (data->val) which could be of three possible float precisions: %.1f, %.2f and %.3f how would I format it using CString::Format to dsiplay only the number of decimal points necessary? eg:
CString sVal;
sVal.Format(L"%.<WHAT GOES HERE?>f", data->val);
if(stValue)
stValue->SetWindowText(sVal);
As in I don’t want any additional zeros on the end of my formatted string.
If you know the precision you’d like simply use
%.*fand supply the precision as an integer argument toCString::Format. If you’d like the simplest effective representation, try%g: