access: Test if a file exists
Package: language
Usage
bool = access (filename) bool = imaccess (imagename)
Parameters
- filename
- The name of the file whose existence is to be tested.
- imagename
- The name of the image whose existence is to be tested.
Description
Access is a boolean intrinsic function returning true ("yes") if the named file exists. Access can only be called as a function in an expression, not as a task.
Examples
1. Type a file if it exists.
if (access ("lib$motd"))
type ("lib$motd")
else
error (11, "File not found")
2. Tell if a file and an image exists.
cl> = access ("lib$motd")
cl> = imaccess ("dev$pix")
Bugs
An optional second argument should be added to test whether the named file can be accessed for reading or writing.