Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. j'ai refais avec un truc qui part de ta méthode mais ca marche pas :
  2.  
  3. if(ligne_commande[0] -> separateur == barre){
  4. int pid , ok, tabpipe[5][2];
  5. int i = 0;
  6.  
  7. do{
  8. ok = pipe (tabpipe[i]);
  9.  
  10. pid = fork();
  11. sleep(1);
  12. if (pid < 0) printf ("ERREUR FORK");
  13.  
  14. else
  15. if (pid == 0)
  16. { /************************** FILS ***********************/
  17. /* PARTIE A COMPLETER */
  18. /*******************************************************/
  19. close(tabpipe[i][0]);
  20. dup2(tabpipe[i][1], 1);
  21. if(i > 0) {
  22. close(tabpipe[i-1][1]);
  23. dup2(tabpipe[i-1][0], 0);
  24. }
  25. sleep(1);
  26. execvp(ligne_commande[i]-> commande[0], ligne_commande[i]-> commande);
  27. }
  28. else i++;
  29. } while(ligne_commande[i] -> separateur == barre);
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement