fork download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <limits>
  4.  
  5. int main()
  6. {
  7. std::istringstream stm( "A: 10\n"
  8. "B: 20\n"
  9. "C: 30\n" ) ;
  10.  
  11. constexpr char delimiter = ':' ;
  12. const auto max = std::numeric_limits<std::streamsize>::max() ;
  13.  
  14. int number ;
  15. while( stm.ignore( max, delimiter ) >> number ) std::cout << number << '\n' ;
  16. }
  17.  
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
10
20
30