http://docs.huihoo.com/joyfire.net/11.html#I246
#include<stdio.h>
#include<stdlib.h>
#include<linux/ipc.h>
#include<linux/msg.h>
main()
{
intqid;
key_tmsgkey;
structmymsgbuf
{
longmtype;/*Messagetype*/
intrequest;/*Workrequestnumber*/
doublesalary;/*Employee'ssalary*/
}msg;
/*GenerateourIPCkeyvalue*/
msgkey=ftok(".",'m');
/*Open/createthequeue*/
if((qid=open_queue(msgkey))==-1){
perror("open_queue");
exit(1);
}
/*Loadupthemessagewitharbitrarytestdata*/
msg.mtype=1;/*Messagetypemustbeapositivenumber!*/
msg.request=1;/*Dataelement#1*/
msg.salary=1000.00;/*Dataelement#2(myyearlysalary!)*/
/*Bombsaway!*/
if((send_message(qid,&msg))==-1){
perror("send_message");
exit(1);
}
}