diff --git a/Exemples/04-Exec/exoTDGr2.c b/Exemples/04-Exec/exoTDGr2.c new file mode 100644 index 0000000..924a9f2 --- /dev/null +++ b/Exemples/04-Exec/exoTDGr2.c @@ -0,0 +1,28 @@ +#include +#include +#include +#include + +int main(int argc, char *argv[]) { + pid_t pid; + + if (argc < 2) { + perror("argument pas bon"); + exit (0); + } + + pid = fork(); + + if (pid == 0) { + if (execvp(argv[1], &argv[1]) == -1) + /* argv+sizeof(char*) c'est trop grand */ + { + perror("dans le exec"); + exit (0); + } + + } else { + wait(NULL); + } + return EXIT_SUCCESS; +} \ No newline at end of file