How do I construct a std::string from a DWORD?

前端 未结 8 2274
死守一世寂寞
死守一世寂寞 2020-12-07 00:30

I have following code:

Tools::Logger.Log(string(GetLastError()), Error);

GetLastError() returns a DWORD a numeric

8条回答
  •  青春惊慌失措
    2020-12-07 01:20

    Use std::stringstream.

    std::stringstream errorStream;
    errorStream << GetLastError();
    Tools::Logger.Log(errorStream.str(), Error);
    

提交回复
热议问题