This is used for reading a message from a specified message queue whose identifier is supplied. Here is its syntax:
int msgrcv(int msqid, void *msgstruc, int msgsize, long typemsg, int flag);
Here, we have to address the following:
- msqid: Represents the message queue identifier of the queue from which the message needs to be read.
- msgstruc: This is the user-defined structure into which the read message is placed. The user-defined structure must contain two members. One is usually named mtype, which must be of type long int that specifies the type of the message, and the second is usually called mesg, which should be of char type to store the message.
- msgsize: Represents the size of text to be read from the message queue in terms ...