Question

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.

Was it helpful?

Solution

because you have the following

std::wostringstream str;

which means it is "output" stream.

change it to

std::wstringstream str;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top