Refactoring in chapters

This commit is contained in:
Fabio Scotto di Santolo
2024-09-02 13:43:29 +02:00
parent 1cf2ae29e8
commit 497e87c3a3
23 changed files with 16 additions and 114 deletions

23
process_chp3/ex13.c Normal file
View File

@@ -0,0 +1,23 @@
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
int main(void)
{
pid_t pid;
pid = fork();
if (pid < 0) {
fprintf(stderr, "Fork failed\n");
return 1;
} else if (pid == 0) {
execlp("/bin/ls", "ls", NULL);
printf("LINEA J\n");
} else {
wait(NULL);
printf("Child complete\n");
}
return 0;
}