title: Query in MSG_EXCEPT flag in message queue
body: <p>Can any one tell me how to use MSG_EXCEPT flag in "msgrcv" function on message queue with example?</p>
  
  <p>I am trying to do it but it will give me an error like : MSG_EXCEPT undeclared 
  I have entered all the header files for "msgrcv" function.</p>
  
  <p>please give me solution with sample code.</p>
  
  <p>I am uploading my sample code of receiver side.</p>
  
  <pre><code>Receiver.c
  
  #include &lt;stdio.h&gt;
  #include &lt;sys/msg.h&gt;
  #include &lt;error.h&gt;
  #include &lt;strings.h&gt;
  #include &lt;mqueue.h&gt;
  #include &lt;sys/ipc.h&gt;
  #include &lt;sys/types.h&gt;
  
  int main() 
  {
    int msqid;
  
    struct message 
    {
      long type;
      char text[20];
    } msg;
  
    struct msqid_ds buf;
  
    int msgtype = 3;
    int num_messages;
    int count;
    int key = 1234;
  
    msqid = msgget(key,0644);
  
    count = msgctl(msqid,IPC_STAT,&amp;buf);
    num_messages = buf.msg_qnum;
  
    printf("Number of messages = %d\n",num_messages);
    if (msgrcv(msqid, (void *) &amp;msg, sizeof(msg.text),4, MSG_EXCEPT | MSG_NOERROR | IPC_NOWAIT)==-1)
    {  
       perror("msgrcv");           
    }
  
    if(num_messages==0)
    {
          printf("Queue is empty\n");
    }
    else
    {     
      printf("%s \n", msg.text);
    }
  
    return 0;
  }
  </code></pre>