hello, I try to test the POSIX mq_open function on book unp like below:
#include "unpipc.h"
# include <mqueue.h>
int main(int argc, char **argv)
{
int c, flags;
mqd_t mqd;
flags = O_RDWR | O_CREAT;
while ((c = getopt(argc, argv, "e")) != -1) {
switch (c) {
case 'e':
flags |= O_EXCL;
break;
}
}
printf("optind = %d,argc = %d\n",optind,argc);
printf("argv[optiond]: %s\n", argv[optind]);
if (optind != argc -1)
err_quit("usage: mqcreate [ - e ] <name>");
if ((mqd = mq_open(argv[optind], flags, FILE_MODE, NULL)) < 0) {
printf( "strerror says open failed: %s\n",strerror(errno));
err_quit("create mqueue failed!\n");
}
else
printf("create mqueue successful\n");
mq_close(mqd);
exit(0);
}
./a.out /test.1234
It works ok but I can't find where is the created mq-file(test.1234)? Does anybody know the default directory? thanks.
I am using ubuntu 10.04