9.57 CHMOD — Change access permissions of files
- Description:
-
CHMODchanges the permissions of a file.This intrinsic is provided in both subroutine and function forms; however, only one form can be used in any given program unit.
- Standard:
- GNU extension
- Class:
- Subroutine, function
- Syntax:
-
CALL CHMOD(NAME, MODE[, STATUS])STATUS = CHMOD(NAME, MODE) - Arguments:
-
NAME Scalar CHARACTERof default kind with the file name. Trailing blanks are ignored unless the characterachar(0)is present, then all characters up to and excludingachar(0)are used as the file name.MODE Scalar CHARACTERof default kind giving the file permission. MODE uses the same syntax as thechmodutility as defined by the POSIX standard. The argument shall either be a string of a nonnegative octal number or a symbolic mode.STATUS (optional) scalar INTEGER, which is0on success and nonzero otherwise. - Return value:
- In either syntax, STATUS is set to
0on success and nonzero otherwise. - Example:
-
CHMODas subroutineprogram chmod_test implicit none integer :: status call chmod('test.dat','u+x',status) print *, 'Status: ', status end program chmod_testCHMODas function:program chmod_test implicit none integer :: status status = chmod('test.dat','u+x') print *, 'Status: ', status end program chmod_test
© Free Software Foundation
Licensed under the GNU Free Documentation License, Version 1.3.
https://gcc.gnu.org/onlinedocs/gcc-5.4.0/gfortran/CHMOD.html