HP C/iX Library Reference Manual (30026-90004)
Chapter 5 103
HP C/iX Library Function Descriptions
access
access
Determines the accessibility of a file.
Syntax
#include <unistd.h>
int access (char *
fname
, int
amode
);
Parameters
fname
A pointer to a character string containing a file name.
amode
An integer indicating whether read or write access to a file is requested.
Return Values
0 Requested access is permitted.
−1 Requested access is denied; errno is set to one of the following values:
ENOENT Read, write, or execute (search) permission is requested
for a null path name, or the named file does not exist.
EACCES The requested access is denied.
ESYSERR A call to a system intrinsic failed.
Description
The access function checks for read or read/write access for the file referenced by
fname
.
The bit pattern contained in
amode
is constructed as follows:
04 Read access
02 Write access
Other values of
amode
are not supported.
The access function is not supported in the POSIX/iX library. If called, access() returns
a -1 and sets errno to ENOSYS.