You are on page 1of 1

IPC USING MESSAGE QUEUES #include<stdio.h> #include<sys/types.h> #include<sys/ipc.h> #include<sys/msg.h> #include<unistd.h> #include<string.h> #include<stdlib.

h> int main() { int mid; char mess[20]; printf("\n\n INTER PROCESS COMMUNICATION USING MESSAGE QUEUE..."); mid=msgget(27,IPC_CREAT|0777); if(mid==-1) { printf("\n\t invalid message id.."); exit(1); } printf("\n Enter the message text:"); scanf("%s",mess); msgsnd(mid,mess,strlen(mess),0); printf("\n\n message has been sent..\n"); printf("\n the sent message is:%s\n",mess); }

You might also like