Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

GETPOS, GETPOSI8

Portability Functions: Return the current position of a file.

Module

USE IFPORT

result = GETPOS (lunit)

result = GETPOSI8 (lunit)

lunit

(Input) INTEGER(4). External unit number of a file. The value must be in the range 0 to 100 and the file must be connected.

Results

The result type is INTEGER(4) for GETPOS; INTEGER(8) for GETPOSI8. The result is the offset, in bytes, from the beginning of the file. If an error occurs, the result value is -1 and the following error code is returned in errno:

EINVAL: lunit is not a valid unit number, or is not open.

These functions are equivalent to FTELL, FTELLI8.