Pliki_SOP/zajecia10/lab_fork.c

15 lines
279 B
C
Raw Normal View History

2018-12-17 16:58:53 +01:00
#include <stdio.h>
int main(){
int res = fork();
if(res>0){
printf("Jestem rodzicem [%d] [%d]\n", res, getpid());
res=wait(NULL);
printf("Zakonczono proces [%d]\n", res);
}
else if (res == 0){
printf("Jestem potomkiem [%d] [%d]\n", res, getpid());
}
return 0;
}