Bonjour,

Je cherche à créer un pipe entre 2 fork/execvp

Voici mon code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
int pipefd[2];
int retour_pipefd=pipe(pipefd);
pid_t process=fork();
if (process==0)
{
    handler_pipe=freopen(pipefd[0],"a",stdout);
    int retour=execvp(arg_list[0],arg_list);
}
else
{
    pid_t process2=fork();
    if (process2==0)
    {
        handler_pipe2=freopen(pipefd[1],"r",stdin);
        int retour=execvp(arg_list2[0],arg_list2);
    }
En ayant la commande cat en list_arg, j'ai un message
cat : sortie standard : mauvais descripteur de fichier.
Quelqu'un peut-il m'aider ?

Merci d'avance.