Files
calc/help/access
2017-05-21 15:38:36 -07:00

50 lines
1.2 KiB
Plaintext

NAME
access - determine existence or accessibility of named file
SYNOPSIS
access(name [, mode])
TYPES
name string
mode integer or string containing only 'r', 'w', 'x' characters
return null value or error
DESCRIPTION
access(name) or access(name, 0) or access(name, "") returns the null
value if a file with this name exists.
If non-null mode is specified, the null value is returned if there
is a file with the specified name and accessibility indicated by the
bits or characters of the mode argument: 'r' or bit 2 for reading,
'w' or bit 1 for writing, 'x' or bit 0 for execution.
EXAMPLE
The system error-numbers and messages may differ for different
implementations
> !rm -f junk
> access("junk")
System error 2
> strerror(.)
"No such file or directory"
> f = fopen("junk", "w")
> access("junk")
> fputs(f, "Alpha")
> fclose(f)
> !chmod u-w junk
> access("junk", "w")
System error 13
> strerror(.)
"Permission denied"
LIMITS
There may be implementation-dependent limits inherited from the
system call "access" used by this function.
LIBRARY
none
SEE ALSO
fopen, fclose, isfile, files