Examveda
Examveda

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;
}

A. 0

B. -1

C. 10

D. none of the mentioned

Answer: Option A


This Question Belongs to Computer Science >> Linux

Join The Discussion

Related Questions on Linux