Portability Function: Determines if a file exists and how it can be accessed.
Module: USE DFPORT
Syntax
Character | Meaning |
---|---|
r | Tests for read permission |
w | Tests for write permission |
x | Tests for execute permission (name must be .COM, .EXE, .BAT, or .CMD) |
(blank) | Tests for existence |
The characters within mode can appear in any order or combination. For example, wrx and r are legal forms of mode and represent the same set of inquiries.
Results:
The value of the result is INTEGER(4). It is zero if all inquiries specified by mode are affirmative. If either argument is illegal, or if the file cannot be accessed in all of the modes specified, one of the following error codes is returned:
For a list of error codes, see IERRNO.
The name argument can contain either forward or backward slashes for path separators.
Note that all files are readable. A test for read permission always returns 0.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB
See Also: INQUIRE, GETFILEINFOQQ
Example
! checks for read and write permission on the file "DATAFILE.TXT"
J = ACCESS ("DATAFILE.TXT", "rw")
! checks whether "DATAFILE.TXT" is executable. It is not, since
! it does not end in .COM, .EXE, .BAT, or .CMD
J = ACCESS ("DATAFILE.TXT","x")