1std::string s = "1234798797";
2std::istringstream iss(s);
3
4int num = 0;
5
6if (!(iss >> num).fail()) {
7 std::cout << num << std::endl;
8}
9else {
10 std::cerr << "There was a problem converting the string to an integer!" << std::endl;
11}
12