Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stddef.h>
- #include <stdlib.h>
- #include <unistd.h>
- #include <sys/types.h>
- #include <sys/wait.h>
- int main () {
- int status=0;
- pid_t pid;
- pid = fork ();
- if (pid == 0)
- {
- /* Questo è il figlio, che lancia gedit */
- execl("/usr/bin/gedit", "gedit", NULL);
- _exit (EXIT_FAILURE);
- }
- else if (pid < 0)
- /* Fork fallito. */
- status = -1;
- else
- /* Questo è il genitore, che aspetta che il figlio termini
- * status e'il valore di ritorno dell'altro processo */
- wait(&status);
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement