首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

请问高人:这个异常提示什么意思

2012-03-09 
请教高人:这个错误提示什么意思?make后提示:ftokerror::Nosuchfileordirectory源文件:#definePROJA0xFFkey

请教高人:这个错误提示什么意思?
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);写错了吧

热点排行