|
楼主 |
发表于 2005-1-20 15:38:43
|
显示全部楼层
struct msgbuf{long type;char data[BUFSIZ];};
struct msgbuf p;
char buf[BUFSIZ];int msgid; int i=1;
msgid=msgget((key_t)1234,0666|IPC_CREAT);
while(i){
fgets(buf,BUFSIZ,stdin);
p.type=1;
strcpy(p.data,buf);
msgsnd(msgid,&p,BUFSIZ,0);
if(strncmp(buf,"end",3)==0) i=0;} |
|