1

DWORD 値を wstring 値に変換したい。

DWORD dw;
wstring wstr(L"");
dw = 2;

「dw」を「dwstr」に割り当てる理想的な方法を提案できますか?

4

3 に答える 3

12

使用std::to_wstring:

std::wstring wstr = std::to_wstring(dw);
于 2013-06-12T06:05:46.080 に答える
2

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.

于 2013-06-12T06:07:33.117 に答える
0

C++03 では、次のことができます。

std::wstringstream stream;
stream << dw;
wstr = stream.str();
于 2013-06-12T06:15:48.507 に答える