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

前端 未结 8 2279
死守一世寂寞
死守一世寂寞 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:19

    You want to read up on ostringstream:

    #include 
    #include 
    
    int main()
    {
       std::ostringstream stream;
       int i = 5;
       stream << i;
       std::string str = stream.str();
    } 
    

提交回复
热议问题