Use a stringstream. You can use it as any other output stream, so you can equally insert std::hex into it. Then extract it's stringstream::str() function.
std::stringstream ss;
ss << "your id is " << std::hex << 0x0daffa0;
const std::string s = ss.str();