pxfaccess
- Date:
10-20-2011
NAME
PXFACCESS - Checks the accessibility of a named file
SYNOPSIS
CHARACTER*n path
INTEGER ilen, iamode, ierror
CALL PXFACCESS(path, ilen, iamode, ierror)
IMPLEMENTATION
Cray Linux Environment (CLE)
STANDARDS
IEEE standard interface for FORTRAN 77
DESCRIPTION
The PXFACCESS subroutine uses the access() system call to check the accessibility of a named file.
The value of iamode indicates specific file permissions. These file permissions are checked against the current file permissions specified for the file in path. If the iamode permissions are allowed for the file in path, PXFACCESS returns a zero in ierror. Otherwise, it returns a nonzero value.
When using the Cray Fortran compiler, all arguments must be of default kind unless documented otherwise. The default kind is KIND=4 for integer, real, complex, and logical arguments.
The following is a list of valid arguments for this subroutine:
- path
An input character variable or array element containing the name of a file.
- ilen
An input integer variable containing the length of path in characters. If ilen is zero, all trailing blanks are removed before calling access().
- iamode
An input integer variable containing the integer value of the symbolic constant for one or more of the following permissions: R_OK, W_OK, X_OK, or F_OK. An integer value for each of these symbolic constants is retrieved through the use of PXFCONST or IPXFCONST. The integer values may be combined through the use of a bitwise inclusive OR function.
- ierror
An output integer variable that contain zero if the requested access is permitted or nonzero if the requested access is not permitted.
In addition to the errors returned by the access(2) system call, PXFACCESS may return the following errors:
- EINVAL
If ilen is less than 0 or ilen is greater than LEN(path)
- ENOMEM
If PXFACCESS is unable to obtain memory to copy path.
EXAMPLES
program test
character*(12) path
integer ilen, iamod, ierr
path = 'testfile'
iamod = 0
ilen = 0
ierr = 0
call pxfconst('R_OK',iamod,ierr)
if (ierr.ne.0) then
print *,'FAIL: error from pxfconst R_OK = ',ierr
else
print *,'PASS: No error from pxfconst R_OK = '
endif
ierr = 0
call pxfaccess(path,ilen,iamod,ierr)
if (ierr.ne.0) then
print *,'FAIL: error from pxfaccess = ',ierr
else
print *,'PASS: No error from pxfaccess = '
endif
end
SEE ALSO
access(2)