Hi, guys,
I am a freshout in China. I feel so glad to meet all of u and exchange my ideas with u here.
I got a problem about how to open a new message queue. I failed when I tried to open a new queue. Below is my source code.
#define MQ_PERMISSION (S_IRWXU | S_IRWXG | S_IRWXO)
char mq_name[100];
struct mq_attr mq_attr_ds;
uint32_t mq_counter = 0;
... ...
mq_attr_ds.mq_maxmsg = 1024; /* maximum number of messages */
mq_attr_ds.mq_msgsize = 100; /* maximum message size */
strcpy(mq_name[mq_counter], "/tmq");
spaH_printf("Mq error information: %s",strerror(errno));
mq_name[mq_counter][4] = '0' + mq_counter/10;
mq_name[mq_counter][5] = '0' + mq_counter%10;
mq_id_array[mq_counter] =
mq_open(mq_name[mq_counter],
O_CREAT | O_RDWR, MQ_PERMISSION, &mq_attr_ds);
spaH_printf("Mq error information: %s",strerror(errno));
if (mq_id_array[mq_counter] == (mqd_t)-1) {
spaH_printf("\nFail to open message queue %s!\n",
mq_name[mq_counter]);
break;
}
else {
spaH_printf("Open message queue %s!\n", mq_name[mq_counter]);
}
And the output message on QNX is:
Mq error information: No such file or directory
Start to open a new message queue.
Mq error information: No such file or directoryMq error information: No such file or directory
Fail to open message queue /tmq00!
Could u please tell me where is my mistake? And what’s the key point when opening a message queue on QNX?
Many Thanks,
Yongjie