/ Published in: C++

This function shows how you can format a double value to a string with a given precision.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
std::string formatToString(int precision, double dValue) { CString sTmpVal; CString sFormat; sFormat.Format("%%.%df", precision); sTmpVal.Format(sFormat, dValue); return static_cast<LPCSTR>(sTmpVal); }
Comments
