#include <sstream> #include <vector> #include <string> std::string myString = "10 15 20 23"; std::stringstream iss( myString ); int number; std::vector<int> myNumbers; while ( iss >> number ) myNumbers.push_back( number );