It is mentioned in ftok() manual
key_t ftok(const char *pathname, int proj_id);
The ftok() function uses the identity of the file named by the given pathname (which must refer to an existing, accessible file) ...
I am confused about const char *pathname
.
What would be the best practice for it?
On my current system I can pass "/home/Andrew/anyfile"
but it is not possible that other systems, on which my program has to work, will have this file.
How about I use "/etc/hosts/"
or "/etc/inittab"
because I am sure all such systems will have these two files? Is it a good idea? Can it cause any problem?
I do not want to ask user to enter filename at the time of execution or pass file name as command line argument.
Is there any other different and better way to decide pathname
?
Which way is the best and most reliable one?
Thanks for your time.