Intel® Fortran Compiler 17.0 Developer Guide and Reference
Portability Function: Returns detailed information about a file.
USE IFPORT
result = LSTAT (name,statb)
name |
(Input) Character*(*). Name of the file to examine. |
statb |
(Output) INTEGER(4) or INTEGER(8). One-dimensional array of size 12; where the system information is stored. See STATfor the possible values returned in statb. |
The result type is INTEGER(4). The result is zero if successful; otherwise, an error code (see IERRNO).
LSTAT returns detailed information about the file named in name.
On Linux* and OS X* systems, if the file denoted by name is a link, LSTAT provides information on the link, while STAT provides information on the file at the destination of the link.
On Windows* systems, LSTAT returns exactly the same information as STAT (because there are no symbolic links on these systems). STAT is the preferred function.
INQUIRE also provides information about file properties.
USE IFPORT
INTEGER(4) info_array(12), istatus
character*20 file_name
print *, "Enter name of file to examime: "
read *, file_name
ISTATUS = LSTAT (file_name, info_array)
if (.NOT. ISTATUS) then
print *, info_array
else
print *, 'Error ',istatus
end if