You just need to pass the address of the struct and cast it to the appropriate pointer type: const char * for mq_send
and char * for mq_receive
.
typedef struct Req
{
pid_t pid;
char data[4096];
} Req;
Req buf;
n = mq_receive(mqdes0, (char *) &buf, sizeof(buf), NULL);
mq_send(mqdes1, (const char *) &buf, sizeof(buf), 0);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…