Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- j'ai refais avec un truc qui part de ta méthode mais ca marche pas :
- if(ligne_commande[0] -> separateur == barre){
- int pid , ok, tabpipe[5][2];
- int i = 0;
- do{
- ok = pipe (tabpipe[i]);
- pid = fork();
- sleep(1);
- if (pid < 0) printf ("ERREUR FORK");
- else
- if (pid == 0)
- { /************************** FILS ***********************/
- /* PARTIE A COMPLETER */
- /*******************************************************/
- close(tabpipe[i][0]);
- dup2(tabpipe[i][1], 1);
- if(i > 0) {
- close(tabpipe[i-1][1]);
- dup2(tabpipe[i-1][0], 0);
- }
- sleep(1);
- execvp(ligne_commande[i]-> commande[0], ligne_commande[i]-> commande);
- }
- else i++;
- } while(ligne_commande[i] -> separateur == barre);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement