pborawski

Funkcja execlp

Oct 8th, 2012
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <unistd.h>
  4. #include <errno.h>
  5. #include <string.h>
  6. #include <sys/types.h>
  7. #include <sys/wait.h>
  8. int main(){
  9.  
  10.     //printf("Mój PID = %d\n",getpid()); //indetyfikator procesu
  11.     //errno=-1;
  12.     //printf("Error in fork = %d %s\n", errno,strerror(errno));
  13.     pid_t pid;
  14.     int wynik;
  15.    
  16.    
  17.     pid = fork();
  18.     if(pid == 0)
  19.     {
  20.             wynik = execlp("ps","ps","aux",NULL);
  21.     }  
  22.     return 0;
  23.        
  24. }
Advertisement
Add Comment
Please, Sign In to add comment