What is the output of this program?
#include<stdio.h>
#include<fcntl.h>
int main()
{
int fd, count;
char buff[10];
if (mkfifo("/tmp/test_fifo",0666) != 0)
perror("mkfifo");
fd = open("/tmp/test_fifo",O_RDONLY|O_NONBLOCK);
count = read(fd,buff,10);
printf("%d\n",count);
return 0;
}
#include<stdio.h>
#include<fcntl.h>
int main()
{
int fd, count;
char buff[10];
if (mkfifo("/tmp/test_fifo",0666) != 0)
perror("mkfifo");
fd = open("/tmp/test_fifo",O_RDONLY|O_NONBLOCK);
count = read(fd,buff,10);
printf("%d\n",count);
return 0;
}
B. -1
C. 10
D. none of the mentioned
Answer: Option A
Join The Discussion