- Invoke the ftok function to generate an IPC key. The filename and ID are supplied while creating the IPC key. These must be the same as what were applied while generating the key for writing the message in the message queue.
- Invoke the msgget function to access the message queue that is associated with the IPC key. The message queue that's associated with this key already contains a message that we wrote through the previous program.
- Define a structure with two members, mtype and mesg.
- Invoke the msgrcv function to read the message from the associated message queue. The structure that was defined in Step 3 is passed to this function.
- The read message is then displayed on the screen.
The messageqrecv.c program for reading ...