请教高人:这个错误提示什么意思?
make 后提示:ftok error:: No such file or directory
源文件:
#define PROJA 0xFF
key_t key1;
char a[] = " "aaa ";
key1 = ftok(a ,);PROJA);
if(key1 == -1)
{
perror( "ftok error: ");
exit(-1);
}
------解决方案--------------------生成key用的啊
The ftok function uses the identity of the file named by the given
pathname (which must refer to an existing, accessible file) and the
least significant 8 bits of proj_id (which must be nonzero) to generate
a key_t type System V IPC key
好像是说 aaa 这个文件必须存在 且第二个参数不能为0
------解决方案--------------------常用的方式是
touch /home/myhome/ipc.foo
foo.c
#define FOO_IPC_KEY_FILE "/home/myhome/ipc.foo "
int main(void)
{
key_t ksem, kshm, kmsg;
ksem = ftok(FOO_IPC_KEY_FILE, 1);
kshm = ftok(FOO_IPC_KEY_FILE, 2);
kmsg = ftok(FOO_IPC_KEY_FILE, 3);
....
}
------解决方案--------------------忘了说了,多看man pages.
http://www.freebsd.org/cgi/man.cgi?query=ftok&apropos=0&sektion=0&manpath=FreeBSD+6.2-RELEASE&format=html
------解决方案--------------------ftok(a ,);PROJA);写错了吧