ftell_(lunit)

Purpose

The ftell_ function returns the offset of the current byte relative to the beginning of the file associated with the specified logical unit UNIT.

The offset returned by the ftell_ function is the result of previously completed I/O operations. No references to ftell_ on a unit with outstanding asynchronous data transfer operations are allowed until the matching WAIT statements for all outstanding asynchronous data transfer operations on the same unit are executed.

Class

Function

Argument type and attributes

lunit
INTEGER(4), INTENT(IN)

Result type and attributes

INTEGER(4)

Result value

The offset returned by the ftell_ function is the absolute offset of the current byte relative to the beginning of the file. This means that all bytes from the beginning of the file to the current byte are counted, including the data of the records and record terminators if they are present.

If the unit is not connected, the ftell_ function returns -1.