我无法在 C 中创建和打开消息队列。
我尝试了各种函数参数mq_open(),但没有任何结果。
我检查过一些类似的问题,但未能找到解决方案。
我不确定我做错了什么。
我收到mq_open: Invalid argument错误。
// Create the message queue
mqd_t mq;
// Open the message queue
mq = mq_open(argv[1], O_RDONLY | O_CREAT, 0666, NULL);
if (mq == (mqd_t)-1) {
perror("mq_open");
exit(EXIT_FAILURE);
}
Run Code Online (Sandbox Code Playgroud)
我随意给它命名为“a”。