tkt
This commit is contained in:
20
SCR3.1/TP4/Exo2/parexec.c
Normal file
20
SCR3.1/TP4/Exo2/parexec.c
Normal file
@@ -0,0 +1,20 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/wait.h>
|
||||
#include <string.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
int n = argc - 2;
|
||||
pid_t pids[n];
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
pids[i] = fork();
|
||||
}
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
waitpid(pids[i], NULL, 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user