msg1 C
msg1 C
h>
#include<stdlib.h>
#include<string.h>
#include<unistd.h>
#include<sys/msg.h>
#include<sys/ipc.h>
#include<sys/types.h>
#include<time.h>
struct msg_st{
};
int buffer[MSGSZ];
int main()
{
int msg_id;
int num;
/**
* if msgget is successful
* send the message
*/
mymessage.msg_type = 1;
srand(time(0));
num = rand()%1000;
mymessage.text[0]=buffer[0] ;
/*
* Now that the message stucture is populated send the message
*/
if ( msgsnd(msg_id,(void*)&mymessage,MSGSZ*sizeof(int),0) == -1)
{
printf("\nmsgsnd failed");
exit(EXIT_FAILURE);
}
exit(EXIT_SUCCESS);