msgrcv()

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:

If the function is executed successfully, the function returns the number of bytes that were actually placed into the text field of the structure that is pointed to by msgstruc. On failure, the function returns a value of -1.