Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

program on pipes not working : in lunux

amit04vermaamit04verma Member Posts: 2
i have made a programin linux and its not working can anyone help me
i am programming on LINUX platform fedora 16

teh program is :

#include
#include
#include

int main()

{

char buff[10];
char tx[]="hello wor
";
int fd[2],t;
pid_t pd;
printf("
%s",tx);

pipe(fd);
pd = fork();
if (pd == 0 )
{
printf("
parent cerated : %d",getpid());
close(fd[0]);
write (fd[1],tx,sizeof(tx));
}
else if(pd == 1)
{
printf("
child cerated : %d",getpid());
close(fd[1]);

printf("
%s",buff);
read(fd[0],buff,sizeof(buff));
printf("the received string is :%s",buff);
}
return (0);
}



Sign In or Register to comment.