fork download
  1. #include <iostream>
  2. #include <sstream>
  3.  
  4. void use(int) { }
  5.  
  6. int main()
  7. {
  8. std::istringstream stream("3 4");
  9. int n;
  10. while (stream) { stream >> n; use(n); }
  11. if (stream.fail()) std::cerr << "choked on bad input\n";
  12. if (stream.bad()) std::cerr << "could not read the input\n";
  13. }
Success #stdin #stdout #stderr 0s 3224KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
choked on bad input