tkt
This commit is contained in:
17
SCR3.1/TP4/Exo1/parexec.c
Normal file
17
SCR3.1/TP4/Exo1/parexec.c
Normal file
@@ -0,0 +1,17 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
int nb = argc-2;
|
||||
pid_t pid;
|
||||
|
||||
for (int i=1 ; i<= nb ; i++){
|
||||
pid = fork();
|
||||
if (pid==0){
|
||||
printf("processus : %d\n", getpid());
|
||||
execl(argv[1], argv[1+i]);
|
||||
}
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user