fork(2) download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <climits>
  4.  
  5.  
  6. int main() {
  7. std::istringstream st("1234567890123"); // Try with 2147483647
  8. int result;
  9.  
  10. st >> result;
  11.  
  12. if (result == INT_MAX)
  13. std::cout << "Overflow!" << std::endl;
  14. else
  15. std::cout << result << std::endl;
  16.  
  17. return 0;
  18. }
Success #stdin #stdout 0s 3028KB
stdin
Standard input is empty
stdout
Overflow!