Вопрос

I have the following code to convert a HANDLE to a wstring. I was thinking that I was on a good way, but I just can not get it right.

wstring handleToWString(HANDLE uHandle)
{
    std::wostringstream str;
    std::wstring ws;
    str << uHandle;
    str >> ws;

    wstring s(str.str());

    return s;
}

The line

    str >> ws;

fails, saying that there is no such operator for this operation.

Can somebody help? Thank you.

Это было полезно?

Решение

because you have the following

std::wostringstream str;

which means it is "output" stream.

change it to

std::wstringstream str;
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top