Advertisement
Guest User

Untitled

a guest
Oct 20th, 2014
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <sys/types.h>a
  2. #include <unistd.h>
  3. #include <stdio.h>
  4.  
  5. int main()
  6. {
  7. //fork();
  8. printf("ID PROCESU = %d\n", getpid());
  9.  
  10. int ema=fork();
  11. wait();//poprzedni proces sie zamyka i trzeba go poczekac. getppid=1
  12. switch(ema)
  13. {
  14. case -1: printf("blad %d %d\n",getpid(), getppid());break;
  15. case 0: printf("dobrze %d %d\n",getpid(), getppid());break;
  16. default:printf("default %d %d\n",getpid(), getppid());break;
  17.  
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement