Thursday, 4 December 2014

program to find size of pipe in UNIX


#include"myHeader.h"
main(int argc,char **argv)
{
int cnt=0;
int p[2];
pipe(p);
fcntl(p[1],F_SETFL,O_NONBLOCK);
while(1)
{
if(write(p[1],"a",1)==1)
cnt++;
else
break;
}
printf("count=%d\n",cnt);
}
OutPut:
madan@madan-Lenovo-G570:~/madan/osconcepts$ ./a.out
count=65536