Thursday, 4 December 2014


#include"myHeader.h"
char ch='a';
main()
{
int p[2];
pipe(p);
if(fork()==0)
{
printf("%d ",getpid());
read(p[0],&ch,1);
printf("%c\n ",ch);
//ch++;
}
else
{
printf("%d ",getppid());
for(ch='a';ch<='z';ch++)
write(p[1],&ch,1);
}
}
OutPut:
madan@madan-Lenovo-G570:~/madan/osconcepts$ cc ex4.c
madan@madan-Lenovo-G570:~/madan/osconcepts$ ./a.out
2817 3378 a