Added Process exercise's chapter

This commit is contained in:
Fabio Scotto di Santolo
2024-08-26 15:35:43 +02:00
parent 2699b3ceec
commit da93cb8369
17 changed files with 665 additions and 0 deletions

23
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;
}