I have an application which writes data (control data, access information etc) to one end of the pipe at parent process. At the child process, I want to read that data as it is.
Parent process performs many write() operation at many location. For reading the data into the buffer, we need to specify the length of the data
read(int fd, buffer, len).
My problem is, parent process writes variable size data every time. So how would the child process came to know the length of data.
I have tried to read single character and add it to buff as,
char ch;
int n = 0;
while(n >= 0)
{
n = read(int fd, ch, 1);
*buff = ch; buff++;
}
But it doesn't seems to way to do it
Please tell me how read variable size data in child process?