DWORD 値を wstring 値に変換したい。
DWORD dw;
wstring wstr(L"");
dw = 2;
「dw」を「dwstr」に割り当てる理想的な方法を提案できますか?
DWORD 値を wstring 値に変換したい。
DWORD dw;
wstring wstr(L"");
dw = 2;
「dw」を「dwstr」に割り当てる理想的な方法を提案できますか?
std::wstring wstr = std::to_wstring(dw);
If you're using an older compiler that doesn't have std::to_wstring
, consider lexical_cast
(e.g., from Boost) instead.
As an aside, if you want to create wstr
as an empty string, just wstring wstr;
suffices.
C++03 では、次のことができます。
std::wstringstream stream;
stream << dw;
wstr = stream.str();