fork(1) download
  1. #include <iostream>
  2. #include <string>
  3.  
  4. int main() {
  5. for (std::string line; std::getline(std::cin, line); ) {
  6. std::cout << "got: '" << line << "'\n";
  7. if (line == "exit")
  8. return 0;
  9. }
  10. }
Success #stdin #stdout 0s 3472KB
stdin
some input
do not exit yet
exit
won't be seen
stdout
got: 'some input'
got: 'do not exit yet'
got: 'exit'