Programming/MFC,C++

C++ — Convert int to string

기적 2013. 5. 24. 14:21

C++ — Convert int to string

By 

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

Other C/C++ not so frequently asked questions.