I am currently writing a program in C using Linux in which a parent process creates a child process and then that child process creates another child processes (so three processes total). I have to pipe a string from parent to the first child process and then from the first child process to the child of that process. I am currently piping the string from parent to child using code similar to this (all code not shown):
pipe(pipeArray)
write(pipeArray[1], myString, length);
close(pipeArray[1]);
read(pipeArray[0], FirstProcessString, length+1);
close(pipeArray[0]);
My problem is the second part of of my program in which now I must take the string from the second child process and pipe it all the way up to the first parent process. How do you pipe from the second child process to the original parent process (the first process)? I have tried variations of this code in order to pipe up with no luck and also researched this topic and was not able to find anything helpful.