?????????????????
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ipc.h> //??????????
struct msgbuf{
long mtype;
char mtext[100];
}; //??????????????????????
int main()
{
key_t key;
int msgid;
struct msgbuf msg1??msg2; //msg1?????????msg2????????
key=ftok("."?? 0xf0); //?????????б????
if( (msgid = msgget(key?? IPC_CREAT|0666)) < 0 ) //??????????????
{
perror("msgget error");
exit(1);
}
msg1.mtype = 1; //????????1??????????????????
memset(msg1.mtext?? 0?? 100); //????????0
strcpy(msg1.mtext?? "hello"); //??strcpy???????????
msgsnd(msgid?? &msg1?? strlen(msg1.mtext)+1?? 0); //?????????????‘