Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <sys/wait.h>
- int main ()
- {
- pid_t pid;
- printf("Moj PID : %d\n",getpid());
- switch(pid = fork()){
- case -1:
- printf("fork error\n");
- case 0:
- printf("%d\n", getpid());
- printf("%d\n", getppid());
- printf("%d\n", pid);
- return 0;
- default:
- wait(0);
- printf("zakonczono proces potomny:");
- printf("%d\n", getpid());
- printf("%d\n", getppid());
- printf("%d\n", pid);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement