fork(1) download
  1. #include <iostream>
  2. #include <sstream>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7. std::stringstream stream;
  8.  
  9. int source = 5;
  10. stream << source;
  11.  
  12. std::cout << "is eof before load ? " << std::boolalpha << stream.eof()
  13. << std::endl;
  14.  
  15. int loaded = 0;
  16. stream >> loaded;
  17.  
  18. std::cout << "is eof after load ? " << stream.eof()
  19. << std::endl;
  20. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
is eof before load ? false
is eof after load ? true