[gagner 32 C++]flotteur Convertir LPCWSTR/LPWSTR
Je ne sais pas comment convertir flotteur LPCWSTR/LPWSTR ou LPCWSTR < -> LPWSTR
Merci beaucoup
[gagner 32 C++]flotteur Convertir LPCWSTR/LPWSTR
Je ne sais pas comment convertir flotteur LPCWSTR/LPWSTR ou LPCWSTR < -> LPWSTR
Merci beaucoup
#include <sstream>
...
float f = 45.56;
wstringstream wss;
wss << f;
// wss.str().c_str() returns LPCWSTR
cout << wss.str() << endl;
...
L'API Win32 native n'a pas de fonctions pour l'impression des valeurs à virgule flottante, mais il y a une addition plus récente appelée strsafe qui a StringCchPrintf
TCHAR buffer[24];
StringCchPrintf(buffer, sizeof(buffer)/sizeof(TCHAR), "%f", float_value);
Merci pour votre commentaire, mais il semble compliqué et le simple ci-dessus fait le même travail :) – nXqd
Ou en C via les variantes printf "w": http://msdn.microsoft.com/fr-fr/library/ms647550%28VS.85%29.aspx. Je préfère cependant cette méthode. –