[win 32 C++]
I don't know how to convert float to LPCWSTR/LPWSTR or LPCWSTR <-> LPWSTR
Thanks a lot
[win 32 C++]
I don't know how to convert float to LPCWSTR/LPWSTR or LPCWSTR <-> LPWSTR
Thanks a lot
#include <sstream>
...
float f = 45.56;
wstringstream wss;
wss << f;
// wss.str().c_str() returns LPCWSTR
cout << wss.str() << endl;
...
Check out the official MSDN pages for floating point support here and for data conversion here - a bonus link - here's the MSDN page for string functions (including multibyte support).
The native Win32 API doesn't have any functions for printing floating point values, but there's a more recent addition called strsafe which has StringCchPrintf
TCHAR buffer[24];
StringCchPrintf(buffer, sizeof(buffer)/sizeof(TCHAR), "%f", float_value);