Programing/C++, C

String to integer (C++에서 string을 int 로 바꾸기)

미류[miryu17] 2010. 5. 28. 18:35
아래와 같이 istringstream 을 사용한다.
using namespace std;

string s = "123";
int i;
bool success;
istringstream myStream(s);

if (myStream>>i)
    success = true;
else
    success = false;
저작자표시 비영리 변경금지 (새창열림)