exemple du cours

This commit is contained in:
Pierre Valarcher 2021-09-29 14:54:19 +02:00
parent 8adf799c7d
commit 1981ce6285

View File

@ -0,0 +1,22 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
int main(int argc, char *argv[]) {
pid_t pid;
pid = fork();
if (pid == 0) {
if (execlp("ps", "ps", "-l", NULL) == -1)
{
perror("dans le exec");
exit (0);
}
} else {
wait(NULL);
}
return EXIT_SUCCESS;
}