Results 1 to 3 of 3
Hi, all:
Sorry for the naive question, but why in my testing code, ftok() always return a value 0xFFFFFFFF ??
Cheers
Pei...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-23-2012 #1Just Joined!
- Join Date
- Dec 2006
- Location
- Surrey, BC, Canada
- Posts
- 5
Why ftok() always return a key value 0xFFFFFFFF ?
Hi, all:
Sorry for the naive question, but why in my testing code, ftok() always return a value 0xFFFFFFFF ??
Cheers
Pei
- 04-24-2012 #2Just Joined!
- Join Date
- Dec 2009
- Location
- California
- Posts
- 89
It shouldn't even compile. You are supposed to pass a pathname and an index to ftok.
So, if I need a unique "key" for a program that will run as my username, I could use something like this:
key_t myKey;
myKey = ftok("/home/andy",1);
If I need an additional key, I could call:
myKey = ftok("/home/andy",2);
Someone else writing a program on my system could use:
myKey = ftok("/home/mary",1);
- 04-24-2012 #3Linux Newbie
- Join Date
- Nov 2009
- Posts
- 117
jiapei100
Notwithstanding what abarclay has said, ftok returns -1 on failure...


Reply With Quote
