msgrcv problem
hello:
I write a program to receive queue,but get some error
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <errno.h>
extern int errno;
int main()
{
struct msgbuf1{
long mtype;
char mtext[100];
} rcvbuf , *msgp;
int rtrn, msgqid ;
while(1)
{
msgp=&rcvbuf;
printf("等待queue的資料\n");
rtrn=msgrcv(0x888,msgp,100,001,0);
if (rtrn == -1)
{perror("msgrcv");exit(1);}
}
printf("資料: %s\n",msgp->mtext);
}
here is the error from execution , but not compiling
等待queue的資料
msgrcv: Invalid argument
|