To convert between an integral or floating point type to a string type, you can use either the std::to_string() or std::to_wstring() function. These functions are available in the <string> header and have overloads for signed and unsigned integer and real types. They produce the same result as std::sprintf() and std::swprintf() would produce when called with the appropriate format specifier for each type. The following code snippet list all the overloads of these two functions.
std::string to_string(int value); std::string to_string(long value); std::string to_string(long long value); std::string to_string(unsigned value); std::string to_string(unsigned long value); std::string to_string(unsigned long long value);