Reader Side,
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
int main()
{
int fd;
char buff[100];
fd = open ("MyPipes",O_RDONLY);
read (fd, buff, 100);
printf ("%s\n",buff);
close(fd);
}
Writer Side,
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
char *ptr = "Akshit Soni";
int main()
{
int fd;
fd = open ("MyPipes",O_WRONLY);
write (fd, ptr, strlen(ptr));
close (fd);
}
Problem is that reader program outputs gets garbage value.