[C++] Converting an Integer to a String

Posted on October 12, 2012


Well this actually  helped me with displaying integers in SFML strings.

In order to convert an int (or any other numeric type, e.g., float,double, etc.) to string, you can use:

#include <sstream>

int i = 5;
std::string s;
std::stringstream out;
out << i;
s = out.str();


Posted in: Programming