, itoa , sprintf . , , .
, . sprintf , itoa, , , .
Additionally: If you can use C ++ 11, you can use to_stringone that returns to you std::string. If you need representations other than decimal, you can do this:
int i = 1234;
std::stringstream ss;
ss << std::hex << i;
ss << std::oct << i;
ss << std::dec << i;
std::bitset<sizeof(int) * std::numeric_limits<unsigned char>::digits> b(i);
ss << b;
std::string str = ss.str();
source
share