source:
trunk/esegui.c
| Last change on this file was 2, checked in by , 15 years ago | |
|---|---|
| File size: 383 bytes | |
| Line | |
|---|---|
| 1 | #include <unistd.h> |
| 2 | #include <stdio.h> |
| 3 | #include <stdlib.h> |
| 4 | |
| 5 | int main(){ |
| 6 | int x = fork(); |
| 7 | if (x < 0){ |
| 8 | perror("Errore nella fork:"); |
| 9 | exit(1); |
| 10 | } else { |
| 11 | if (x != 0){ |
| 12 | printf("Processo padre\n"); |
| 13 | } else { |
| 14 | char* argv[] = {"/bin/ls", "/usr", 0}; |
| 15 | execv("/bin/ls",argv ); |
| 16 | perror("Errore nella exec:"); |
| 17 | } |
| 18 | } |
| 19 | return 0; |
| 20 | } |
| 21 | |
| 22 | |
| 23 | |
| 24 |
Note:
See TracBrowser
for help on using the repository browser.