fork download
  1. #include <iostream>
  2. #include <unistd.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. int pid;
  7. pid = fork();
  8. if(pid==0)
  9. {
  10. cout<<"child running\n";
  11. }
  12. else
  13. cout<<"parent running\n";
  14.  
  15. return 0;
  16. }
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
parent running
child running