Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 9/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

FSTAT

Portability Function: Returns detailed information about a file specified by a 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:

Element

Description

Values or Notes

statb(1)

Device the file resides on

W*S: Always 0

L*X: System dependent

statb(2)

File inode number

W*S: Always 0

L*X: System dependent

statb(3)

Access mode of the file

See the table in Results

statb(4)

Number of hard links to the file

W*S: Always 1

L*X: System dependent

statb(5)

User ID of owner

W*S: Always 1

L*X: System dependent

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

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

See Also