c++ int from string code example Example 1: c++ parse int std::string s = "10"; int i = std::stoi(s); Example 2: c++ string to int atoi( str.c_str() )