Add more code snippet from the course.
[TD_SE.git] / fils / fils.c
1 #include <unistd.h>
2 #include <stdio.h>
3 #include <sys/types.h>
4
5 int main() {
6 pid_t fils_pid;
7 fils_pid = fork();
8
9 if (fils_pid == 0) {
10 printf("Je suis le fils avec pid %d\n", getpid());
11 } else if (fils_pid > 0) {
12 printf("Je suis le pere avec pid %d\n", getpid());
13 } else {
14 printf("Erreur a la creation du fils\n");
15 }
16 }