#include #include #include #include #include int main() { int ecrit; int lu; int p[2]; pipe(p); pid_t pf = fork(); if (pf == 0) { pid_t pf1 = fork(); if (pf1 == 0) { while (read(p[0],&lu,sizeof(int)) > 0){ printf("%d received %d\n", getpid(), lu); } } } else{ pid_t pf2 = fork(); if (pf2 == 0) { } else{ while(1){ sleep(3); ecrit = getpid(); printf("%d sent %d\n", ecrit, ecrit); write(p[1],&ecrit,sizeof(int)); } } } }