Visible to Intel only — GUID: GUID-101E4E76-C2B7-46D8-95D1-9AD2D096BCE8
Visible to Intel only — GUID: GUID-101E4E76-C2B7-46D8-95D1-9AD2D096BCE8
FSTAT
Portability Function: Returns detailed information about a file specified by an external unit number.
Module
USE IFPORT
result = FSTAT (lunit,statb)
lunit |
(Input) INTEGER(4). External unit number of the file to examine. |
||||||||||||||||||||||||||||||||||||||||||
statb |
(Output) INTEGER(4) or INTEGER(8). One-dimensional array of size 12; where the system information is stored. The elements of statb contain the following values:
|
Results
The result type is INTEGER(4). The result is zero if successful; otherwise, returns an error code equal to EINVAL (lunit is not a valid unit number, or is not open).
The access mode (the third element of statb) is a bitmap consisting of an IOR of the following constants:
Symbolic name |
Constant |
Description |
Notes |
---|---|---|---|
S_IFMT |
O'0170000' |
Type of file |
|
S_IFDIR |
O'0040000' |
Directory |
|
S_IFCHR |
O'0020000' |
Character special |
Never set on Windows* systems |
S_IFBLK |
O'0060000' |
Block special |
Never set on Windows systems |
S_IFREG |
O'0100000' |
Regular |
|
S_IFLNK |
O'0120000' |
Symbolic link |
Never set on Windows systems |
S_IFSOCK |
O'0140000' |
Socket |
Never set on Windows systems |
S_ISUID |
O'0004000' |
Set user ID on execution |
Never set on Windows systems |
S_ISGID |
O'0002000' |
Set group ID on execution |
Never set on Windows systems |
S_ISVTX |
O'0001000' |
Save swapped text |
Never set on Windows systems |
S_IRWXU |
O'0000700' |
Owner's file permissions |
|
S_IRUSR, S_IREAD |
O'0000400' |
Owner's read permission |
Always true on Windows systems |
S_IWUSR, S_IWRITE |
O'0000200' |
Owner's write permission |
|
S_IXUSR, S_IEXEC |
O'0000100' |
Owner's execute permission |
Based on file extension (.EXE, .COM, .CMD, or .BAT) |
S_IRWXG |
O'0000070' |
Group's file permissions |
Same as S_IRWXU on Windows systems |
S_IRGRP |
O'0000040' |
Group's read permission |
Same as S_IRUSR on Windows systems |
S_IWGRP |
O'0000020' |
Group's write permission |
Same as S_IWUSR on Windows systems |
S_IXGRP |
O'0000010' |
Group's execute permission |
Same as S_IXUSR on Windows systems |
S_IRWXO |
O'0000007' |
Other's file permissions |
Same as S_IRWXU on Windows systems |
S_IROTH |
O'0000004' |
Other's read permission |
Same as S_IRUSR on Windows systems |
S_IWOTH |
O'0000002' |
Other's write permission |
Same as S_IWUSR on Windows systems |
S_IXOTH |
O'0000001' |
Other's execute permission |
Same as S_IXUSR on Windows systems |
STAT returns the same information as FSTAT, but accesses files by name instead of external unit number.
Example
USE IFPORT
integer(4) statarray(12), istat
OPEN (unit=1,file='datfile.dat')
ISTAT = FSTAT (1, statarray)
if (.NOT. istat) then
print *, statarray
end if