문제

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