string 转 int,int 转 string

string str="12345";
int b=atoi(str.c_str());

可以配合atof,转为double

char buf[10];
sprintf(buf, "%d", 100);
string b = buf;
posted @ 2016-03-18 22:53  copperface  阅读(171)  评论(0编辑  收藏  举报