fork(3) download
  1. #include <iostream>
  2. #include <unistd.h>
  3.  
  4. using std::cout;
  5. using std::endl;
  6.  
  7. int main() {
  8.  
  9. size_t n = 3;
  10. for (size_t i = 0; i < n; i++){
  11. fork();
  12. }
  13. sleep(1);
  14.  
  15. cout << "x ";
  16. }
Success #stdin #stdout 0s 3456KB
stdin
Standard input is empty
stdout
x x x x x x x x