#include <sstream> std::stringstream sstream; sstream << std::hex << my_integer; std::string result = sstream.str();