you can use function stoi http://www.cplusplus.com/reference/string/stoi/ or boost::lexical_cast