Initial revision
[LeanCalc.git] / help / access
1 NAME
2     access - determine existence or accessibility of named file
3
4 SYNOPSIS
5     access(name [, mode])
6
7 TYPES
8     name        string
9     mode        integer or string containing only 'r', 'w', 'x' characters
10
11     return      null value or error
12
13 DESCRIPTION
14     access(name) or access(name, 0) or access(name, "") returns the null
15     value if a file with this name exists.
16
17     If non-null mode is specified, the null value is returned if there
18     is a file with the specified name and accessibility indicated by the
19     bits or characters of the mode argument: 'r' or bit 2 for reading,
20     'w' or bit 1 for writing, 'x' or bit 0 for execution.
21
22 EXAMPLE
23     The system error-numbers and messages may differ for different
24         implementations
25
26     > !rm -f junk
27     > access("junk")
28         System error 2
29     > strerror(.)
30         "No such file or directory"
31     > f = fopen("junk", "w")
32     > access("junk")
33     > fputs(f, "Alpha")
34     > fclose(f)
35     > !chmod u-w junk
36     > access("junk", "w")
37         System error 13
38     > strerror(.)
39         "Permission denied"
40
41 LIMITS
42     There may be implementation-dependent limits inherited from the
43     system call "access" used by this function.
44
45 LINK LIBRARY
46     none
47
48 SEE ALSO
49     fopen, fclose, isfile, files
50