mq_receive() example


 
Thread Tools Search this Thread
Special Forums UNIX Desktop Questions & Answers mq_receive() example
# 1  
Old 05-19-2008
Data mq_receive() example

can anyone provide me with a simple example of mq_receive().
# 2  
Old 05-19-2008
ssize_t mq_receive(mqd_t mqdes, char *buf, size_t len, unsigned *prio)
takes the oldest message with the highest priority from mqdes into buf. prio, if not NULL, is filled with the priority of the given message.
Returns the length of the message received, or -1 on error.
Quote:

msgsz = mq_receive(msgq_id, msgcontent, MAX_MSG_LEN, &sender);
if (msgsz == -1) {
perror("In mq_receive()");
exit(1);
}

Last edited by push; 05-19-2008 at 07:14 AM.. Reason: no notes
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. Programming

POSIX mq_receive issue: Message too long

Hello, I am trying to implement posix message queue application. I am faced with an error on the mq_receive section. It says "Message too long". I've tried couple of small tweeks, but to no result. Please do suggest any rectificaitons. mq_send section-works successfully #include... (2 Replies)
Discussion started by: katwalatapan
2 Replies
Login or Register to Ask a Question