Advertisement
Guest User

Untitled

a guest
Oct 30th, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.69 KB | None | 0 0
  1. #include <unistd.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5.  
  6. int main(char *argv[]) {
  7.  
  8.   mkfifo("PIPE_myFTP",S_IRUSR|S_IWUSR);
  9.   int personne = fork();
  10.   int pidserv=0;
  11.   if (personne ==0) //= Fils
  12.     {
  13.       pidserv = getpid();
  14.       char* args[]={"unServeur.exe",NULL};
  15.       execvp("unServeur.exe",args);
  16.     }
  17.     else
  18.     {
  19.         fork();
  20.         if ( fork() == 0 && getpid() != pidserv)
  21.           {
  22.             char* args[]={pidserv,argv[0],NULL};
  23.             execvp("unClient.exe",args);
  24.           }
  25.         else if (fork() == 0)
  26.         {
  27.           wait();
  28.           wait();
  29.           system('rm PIPE_myFTP')
  30.           kill(getpid());
  31.         }
  32.     }
  33.  
  34.   return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement