Find the answer to your Linux question:
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.
  1. #1
    Just 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

  2. #2
    Just Joined!
    Join Date
    Dec 2009
    Location
    California
    Posts
    98
    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);

  3. #3
    Linux Newbie
    Join Date
    Nov 2009
    Posts
    238
    jiapei100

    Notwithstanding what abarclay has said, ftok returns -1 on failure...

  4. $spacer_open
    $spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •