Developer Guide and Reference

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

PXFFILENO

POSIX Subroutine: Returns the file descriptor associated with a specified unit.

Module

USE IFPOSIX

CALL PXFFILENO (lunit,fd,ierror)

lunit

(Input) INTEGER(4). A Fortran logical unit.

fd

(Output) INTEGER(4). The returned file descriptor.

ierror

(Output) INTEGER(4). The error status.

If successful, ierror is set to zero; otherwise, an error code. Possible error codes are:

  • EINVAL: lunit is not an open unit.

  • EBADF: lunit is not connected with a file descriptor.

The PXFFILENO subroutine returns in fd the file descriptor associated with lunit.

NOTE:

On Windows* systems, the default value of the POSIX/IO flag is 0, which prevents OPEN from connecting a unit to a file descriptor and causes PXFFILENO to return an error.

To prevent this, call subroutine PXFPOSIXIO and set the value of the POSIX/IO flag to 1. This setting allows a connection to a file descriptor.

NOTE:

The file-descriptor used by POSIX is not the same as the corresponding file handle used by Windows, so it does not have the same value.

See Also