Go to the previous, next section.
int access(const char *pathname, int
mode);
pathname: [in] the path of the file to test.
mode: [in] indicates what the task wants to test.
Checks whether the calling task has the necessary access rights to perform
operations specified by mode on the file pathname.
mode is a mask consisting of one or more of the values
R_OK, W_OK, X_OK and F_OK
which respectively test if the taks can read, write, execute or test if the file
exists. The test is performed using the real uid and gid of the
calling task. Only the access bits of the file are tested.
Note: only the final component of the path is checked using the real uid and gid. All the other components of the path are checked using the effective uid and gid.
On success, zero is returned. On error, -1 is returned and errno
is set to one of the following values:
EINVAL: mode is not a valid value.
EACCESS, EFAULT, ENOENT,
ENOTDIR, ENOMEM, ENAMETOOLONG or
ELOOP.