
Linux System Programming Techniques
By :

In the previous recipe, we wrote a program that creates a FIFO and writes a message to it. We also tested it using cat
to receive the messages. In this recipe, we'll write a C program that reads from the FIFO.
Reading from a FIFO isn't any different than reading from a regular file, or let's say, stdin.
Before you start this recipe, it's best if you complete the previous recipe first. We'll use the program from the previous recipe to write data to the FIFO that we'll receive in this recipe.
You'll also need the usual tools; that is, the GCC compiler, the Make tool, and the generic Makefile.
In this recipe, we'll write a receiving program for the sender we wrote in the previous recipe. Let's get started:
fifo-receiver.c
. We will open the FIFO with a file stream and then read it character by character...