std::string uint2string(const uint32_t value, int radix /*= 10*/) { std::string strString = ""; switch (radix) { case 10: strString = std::to_string(value); break; case 16: { char chTemp[64] = { 0 }; sprintf_s(chTemp, "0x%02x", value); strString = chTemp; } break; default: break; } return strString; }
来源:https://www.cnblogs.com/Zoya-/p/12421545.html