ACCESS(3f)

DESCRIPTION
ACCESS(NAME, MODE) checks whether the file NAME exists, is readable, writable or executable. Except for the executable check, ACCESS can be replaced by Fortran 95's INQUIRE.

STANDARD
GNU extension

CLASS
Inquiry function

SYNTAX
RESULT = ACCESS(NAME, MODE)

ARGUMENTS

NAME Scalar CHARACTER of default kind with the file name. Tailing blank are ignored unless the character achar(0) is present, then all characters up to and excluding achar(0) are used as file name. MODE Scalar CHARACTER of default kind with the file access mode, may be any concatenation of "r" (readable), "w" (writable) and "x" (executable), or " " to check for existence.

RETURN VALUE
Returns a scalar INTEGER, which is 0 if the file is accessible in the given mode; otherwise or if an invalid argument has been given for MODE the value 1 is returned.

EXAMPLE
          program access_test
            implicit none
            character(len=*), parameter :: file = 'test.dat'
            character(len=*), parameter :: file2 = 'test.dat '//achar(0)
            if(access(file,' ') == 0) print *, trim(file),' is exists'
            if(access(file,'r') == 0) print *, trim(file),' is readable'
            if(access(file,'w') == 0) print *, trim(file),' is writable'
            if(access(file,'x') == 0) print *, trim(file),' is executable'
            if(access(file2,'rwx') == 0) &
              print *, trim(file2),' is readable, writable and executable'
          end program access_test

SEE ALSO

AUTHOR

This information was taken from the GFortran documentation (https://gcc.gnu.org/onlinedocs/gcc-5.3.0/gfortran/) and converted to a manpage by AstroFloyd (http://astrofloyd.org).