-
Notifications
You must be signed in to change notification settings - Fork 0
/
tube.c
40 lines (36 loc) · 774 Bytes
/
tube.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/wait.h>
int main()
{
int p_f[2],f_p[2];
pipe(p_f);
pipe(f_p);
int pid;
pid=fork();
if(pid==0)
{
close(f_p[0]);
char P[40]="gestionnaire du projet";
char P1[40]="gestionnaire du projet et admin bdd";
write(f_p[1],&P,40*sizeof(char));
printf("fils : %s\n",P);
sleep(1);
write(f_p[1],&P1,40*sizeof(char));
printf("fils : %s\n",P1);
//sleep(1);
}
else
{
close(p_f[0]);
char T[40]="quelle profession tu admires";
char T1[40]="tu es informaticien";
write(p_f[1],&T,40*sizeof(char));
printf("pere : %s\n",T);
sleep(1);
write(p_f[1],&T1,40*sizeof(char));
printf("pere : %s\n",T1);
sleep(1);
}
}