본문 바로가기
Programming/MFC,C++

C++ — Convert int to string

by 기적 2013. 5. 24.

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.


댓글