You are on page 1of 1

#include<sys/types.

h>
#include<sys/stat.h>
#include<errno.h>
#include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<fcntl.h>
#include<stdlib.h>
int main()
{
printf("I am the writer program\n");
writefunction();
printf("i am done with writing\n");
return 1;
}
int writefunction()
{
int fd;
int retval;
char writebuffer[32];
size_t buffsize=31;
retval=mkfifo("anni",S_IRWXU);
if(-1==retval)
{ printf("FIFO creation error");
if(EEXIST==errno)
printf("FIFO already exists\n");
else
exit(1);
}
fd=open("anni",O_WRONLY);
memset(writebuffer,'10',32);
printf("please enter the string to send to the readeer\n");
buffsize=read(0,writebuffer,buffsize);
if(buffsize>0)
write(fd,writebuffer,buffsize);
close(fd);
return;
}

You might also like