ASR3.1/Controle/Exercice 1/B1.c

17 lines
285 B
C
Raw Permalink Normal View History

2021-10-08 15:33:49 +02:00
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char const *argv[]) {
char* arg[2] = {NULL, NULL};
if (!fork()) {
if (argv[1][0] == '1') {
arg[0] = "C1";
} else {
arg[0] = "C2";
}
execvp(arg[0], arg);
}
sleep(5);
return EXIT_SUCCESS;
}