c语言形式
std::string str;
int i = atoi(str.c_str());
c++形式
std::string str;
int i = std::stoi(str);
同样, 可以使用 stol(long), stof(float), stod(double) 等.
参考: http://en.cppreference.com/w/cpp/string/basic_string/stol
转自http://blog.youkuaiyun.com/caroline_wendy/article/details/29390573