Method-1
std::stoi(str);
// str is your number as std::string. C++11 need.
Method-2
string a = "25";
int b = atoi(a.c_str());
Method-3
std::istringstream ss(thestring);
ss >> thevalue;
std::stoi(str);
// str is your number as std::string. C++11 need.
string a = "25";
int b = atoi(a.c_str());
std::istringstream ss(thestring);
ss >> thevalue;