key_t ftok(const char *pathname, int proj_id);
What if I use a filename for the first parameter instead of pathname? For example, my program is in the following directory /afs/edu/id/group/a/ftok_test.c
In this case, if I use
int key = ftok(/afs/edu/id/group/a/ftok_test.c, 1);
int key = ftok(/afs/edu/id/group/a, 1);
What is the difference these two?
The documentation says:
The application shall ensure that the path argument is the pathname of an existing file that the process is able to stat().
So your second example is ill-formed, because it refers to a directory.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.