Generates a standard interprocess communication key that is usable in subsequent calls to semget. This function is supported on OpenVMS Integrity servers and Alpha only. Format #include <ipc.h> key_t ftok (const char *path_name, int project_id);
1 – Argument
path_name the pathname of an existing file that is accessible to the process. project_id a value that uniquely identifies a project.
2 – Description
The ftok function returns a key, based on the path_name and project_id parameters, that is usable in subsequent calls to the semget function. The ftok function returns the same key for all paths that name the same file, when called with the same project_ id parameter. Different keys are returned for the same file if different project_id parameters are used, or if paths are used that name different files existing on the same file system at the same time. If a file named by path_name is removed and recreated with the same name, the ftok function may return a different key than the original one. Only the low order 8 bits of project_id are significant. The behavior of ftok is unspecified if these bits are 0. For maximum portability, project_id must be a single-byte character. Upon successful completion, the ftok function returns a key. Otherwise, it returns the value (key_t)-1 and sets errno to indicate the error.
3 – Return Values
n Upon successful completion, the ftok function returns a key. (key_t)-1 Indicates an error. The function sets errno to: o EACCESS - Search permission is denied for a component of the path_name parameter.