title: IPC Queue msgsnd error
body: <p>This is a simple program to send msg to queue but it gives "snd error" as the output.
  the queue is created. I checked with ipcs -q.
  What have i done wrong?</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;unistd.h&gt;
  #include&lt;sys/ipc.h&gt;
  #include&lt;sys/msg.h&gt;
  #include&lt;sys/types.h&gt;
  #include&lt;stdlib.h&gt;
  struct msg{
  int mtype;
  char mtext[1024];
  
  }snd;
  void main()
  {
  int id;
  if(id=msgget(1234,IPC_CREAT|0666)&lt;0)
  {
      printf("ipc error");
  }
  else{
      snd.mtype=1;
      scanf("%[^\n]",snd.mtext);
      getchar();
  
      if(msgsnd(id,&amp;snd,sizeof(snd.mtext),IPC_NOWAIT)&lt;0){
              printf("snd error");
      }
      else {
          printf("msg snd");
      }
  
  }
  
  }
  </code></pre>