Reputation: 894
I want to convert a DWORD value to wstring value.
DWORD dw;
wstring wstr(L"");
dw = 2;
Can you suggest ideal way to assign 'dw' to 'dwstr' ?
Upvotes: 2
Views: 11740
Reputation: 26169
On C++03 you can do:
std::wstringstream stream;
stream << dw;
wstr = stream.str();
Upvotes: 0
Reputation: 490178
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.
Upvotes: 2