转自http://blog.csdn.net/caroline_wendy/article/details/29390573
C语言转换形式:
- ...
- std::string str;
- int i = atoi(str.c_str());
- ...
C++转换形式(C++11):
- ...
- std::string str;
- int i = std::stoi(str);
- ...
同样, 可以使用 stol(long), stof(float), stod(double) 等.
int 转string c++11的to_string函数