/* Message Queues: client. */ #include #include #include #include #include #include "common.h" struct inf_msgbuf { long mtype; struct inf_t data; }; int main( int argc, char* argv[] ) { struct inf_msgbuf msg; key_t key; int msg_id; key = getuid() + 6662; massert((msg_id = msgget( key, 0600 )) < 0, "msgget"); if( msgrcv(msg_id, &msg, sizeof(struct inf_msgbuf)+1, 1, 0) < 0 ) perror("msgrcv"); print_inf( &msg.data ); return 0; }