Join With Me...

3:06 AM

Fork and Pipe program in C

#include
main()
{
 int p1[2],p2[2],i=1,t=100,t1,res=0;
int arr[]={1,2,3,4,5,6,7,8,9,10};
int pro;
printf("RESULT :  %d\n",i);
pipe(p1);
pro=fork();
if(pro==0)
{
printf("RESULT(T) :  %d\n",i);
read(p1[0],t1,2);
write(i,t1,2);
printf("AFTER %d",i);
}
else
{
write(p1[1],t,2);
}
}

0 comments:

Post a Comment