//Program to
implement msgq
/*CPP Program for msg queue in Linux
pipes work with
related process parent-child only.
Fifo can make
unrelated process to communicate but
fifo created does
not persists for use in future.
Shared memory is
similar to fifo but over comes this and can be used later also.
Program to implement
IPC Message Queues IPC mechanism.
msgqSendkirk.c adds
the message on the message queue.
msgqRecvSpock.c
reads and removes the message from the message
queue.To use this
program first compile and run msgqSendkirk.c
to add a message to
the message queue. To see the
Message Queue in
other terminal run msgqRecvSpock.c
ipcs -q shows the
msg ques.
ipcrm -q 131073
removes the msgq created say 131071 */
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include
<sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
//1. declaring the
msg structure
struct my_msgbuf
{