Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <sys/types.h>
  2. #include <unistd.h>
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6.  
  7. int main()
  8. {
  9. int pid;
  10.  
  11. pid=fork();
  12.  
  13. if(pid == -1)
  14. exit(EXIT_FAILURE);
  15.  
  16.  
  17. if(pid==0)
  18. {
  19. printf("POTOMEK\n PID:%d PID rodzica:%d\n",getpid(),getppid());
  20. return 0;
  21. }
  22. else
  23. {
  24. printf("RODZIC\n PID:%d PID potomka:%d\n",getpid(),pid);
  25. }
  26.  
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement