Next: CMPLX, Previous: CHDIR, Up: Intrinsic Procedures
CHMOD — Change access permissions of filesCHMOD changes the permissions of a file. This function invokes
/bin/chmod and might therefore not work on all platforms.
This intrinsic is provided in both subroutine and function forms; however,
only one form can be used in any given program unit.
CALL CHMOD(NAME, MODE[, STATUS])
|
STATUS = CHMOD(NAME, MODE)
|
| NAME | Scalar CHARACTER of default kind with the
file name. Trailing blanks are ignored unless the character
achar(0) is present, then all characters up to and excluding
achar(0) are used as the file name.
|
| MODE | Scalar CHARACTER of default kind giving the
file permission. MODE uses the same syntax as the MODE
argument of /bin/chmod.
|
| STATUS | (optional) scalar INTEGER, which is
0 on success and nonzero otherwise.
|
0 on success and nonzero
otherwise.
CHMOD as subroutine
program chmod_test
implicit none
integer :: status
call chmod('test.dat','u+x',status)
print *, 'Status: ', status
end program chmod_test
CHMOD as function:
program chmod_test
implicit none
integer :: status
status = chmod('test.dat','u+x')
print *, 'Status: ', status
end program chmod_test