How it works...
First, we will invoke the ftok function to generate an IPC key. The filename and ID that are supplied while creating the IPC key are messagefile and a, respectively. These filenames and ID must be the same as the ones that were applied while generating the key for writing the message in the message queue. The generated key is assigned to the key variable.
Thereafter, we will invoke the msgget function to access the message queue that is associated with the IPC key. The identifier of the accessed message queue is assigned to the msqid variable. The message queue that's associated with this key already contains the message that we wrote in the previous program.
Then, we will define a structure by the name msgstruc with two members, ...
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