Visible to Intel only — GUID: GUID-2CB75AB0-9CDF-49D6-9C85-FA89B3AE8C68
Visible to Intel only — GUID: GUID-2CB75AB0-9CDF-49D6-9C85-FA89B3AE8C68
CHMOD
Portability Function: Changes the access mode of a file.
Module
USE IFPORT
result = CHMOD (name,mode)
name |
(Input) Character*(*). Name of the file whose access mode is to be changed. Must have a single path. |
|||||||||||||||||||||||||||
mode |
(Input) Character*(*). File permission: either Read, Write, or Execute. The mode parameter can be either symbolic or absolute. An absolute mode is specified with an octal number, consisting of any combination of the following permission bits ORed together:
|
The following regular expression represents a symbolic mode:
[ugoa]*[+-=] [rwxXst]*
On Windows* systems, "[ugoa]*" is ignored. On Linux* systems, a combination of the letters "ugoa" control which users' access to the file will be changed:
u |
The user who owns the file |
g |
Other users in the group that owns the file |
o |
Other users not in the group that owns the file |
a |
All users |
"[+ - =]" indicates the operation to carry out:
+ |
Add the permission |
- |
Remove the permission |
= |
Absolutely set the permission |
"[rwxXst]*" indicates the permission to add, subtract, or set. On Windows systems, only "w" is significant and affects write permission; all other letters are ignored. On Linux systems, all letters are significant.
Results
The result type is INTEGER(4). It is zero if the mode was changed successfully; otherwise, an error code. Possible error codes are:
ENOENT: The specified file was not found.
EINVAL: The mode argument is invalid.
EPERM: Permission denied; the file's mode cannot be changed.
Example
USE IFPORT
integer(4) I,Istatus
I = ACCESS ("DATAFILE.TXT", "w")
if (i) then
ISTATUS = CHMOD ("datafile.txt", "[+w]")
end if
I = ACCESS ("DATAFILE.TXT","w")
print *, i