Simple C programs demonstarting use of mkfifo( ) system call.

SYS CALL NAME mkfifo – make FIFOs (named pipes)SYNOPSIS mkfifo [OPTION]… NAME… DESCRIPTION Create named pipes (FIFOs) with the given NAMEs. Mandatory arguments to long options are mandatory for short options too. -m, –mode=MODE set file permission bits to MODE, not a=rw – umask -Z, –context=CTX set the SELinux security context of each NAME to CTX –help display this help and exit –version output version information and exit #include<stdio.h>#include<sys/errno.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include<string.h>void main (){ int fd; char a[10]; char buff[10]; int i=0; printf("nnEnter numbersnn"); for(i=0;i<10;i++) scanf("%c",&a[i]); char * myfifo = "/home/student/shubham"; /* create the FIFO (named pipe) */ mkfifo(myfifo, 0666); /* write to the FIFO */ fd = open(myfifo,O_WRONLY); write(fd,a,sizeof(a)); close(fd); /* remove the FIFO */