Next: AssignPipe
Up: Functions and procedures
Previous: Functions and procedures
Function Access (Path : Pathstr; Mode : integer) : Boolean;
Tests user's access rights on the specified file. Mode is a mask existing of
one or more of
- R_OK
- User has read rights.
- W_OK
- User has write rights.
- X_OK
- User has execute rights.
- F_OK
- User has search rights in the directory where the file is.
The test is done with the real user ID, instead of the effective user ID.
If access is denied, or an error occurred, false is returned.
LinuxError is used to report errors:
- sys_eaccess
- The requested access is denied, either to the file or one
of the directories in its path.
- sys_einval
- Mode was incorrect.
- sys_enoent
- A directory component in Path doesn't exist or is a
dangling symbolic link.
- sys_enotdir
- A directory component in Path is not a directory.
- sys_enomem
- Insufficient kernel memory.
- sys_eloop
- Path has a circular symbolic link.
Chown, Chmod, Access (2)
- Example
-
Program Example26;
{ Program to demonstrate the Access function. }
Uses linux;
begin
if Access ('/etc/passwd',W_OK) then
begin
Writeln ('Better check your system.');
Writeln ('I can write to the /etc/passwd file !');
end;
end.
Michael Van Canneyt
Thu Sep 10 13:59:33 CEST 1998