How it works...
We defined a macro, max, of size of 50, a string, str, of size max, and an array, pp, with size 2 . We will invoke the pipe function to connect two processes and pass the pp array to it. The index location, pp[0], will get the file descriptor for the reading end of the pipe and pp[1] will get the file descriptor for the write end of the pipe. The program will exit if the pipe function does not execute successfully.
You will be prompted to enter the first message to be written into the pipe. The text that's entered by you will be assigned to the string variable, str. Invoke the write function and the string in str will be written into the pipe, pp. Repeat the procedure for the second message. The second text that's entered ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access