Domanda

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.

È stato utile?

Soluzione

because you have the following

std::wostringstream str;

which means it is "output" stream.

change it to

std::wstringstream str;
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top