所以我有,让我们说
float x;
Run Code Online (Sandbox Code Playgroud)
我有
LPCWSTR message=L"X is";
Run Code Online (Sandbox Code Playgroud)
如何使用消息创建LPCWSTR
"X是[x]"
?
你可以使用wstringstream:
#include <string>
#include <sstream>
#include <iostream>
int main()
{
float x = 0.1f;
std::wstringstream s;
s << L"X is " << x;
std::wstring ws = s.str();
std::wcout << ws << "\n";
return 0;
}
Run Code Online (Sandbox Code Playgroud)
并LPCWSTR根据需要创建一个,或者只使用std::wstring.