Monday, October 27, 2008

convert int to string, cpp

http://notfaq.wordpress.com/2006/08/30/c-convert-int-to-string/#

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();

No comments:

Post a Comment