HP Fortran Programmer's Guide (B3908-90031; September 2011)

Writing HP-UX applications
Using HP-UX file I/O
Chapter 7 179
Establishing a connection to a file
HP-UX I/O system calls require an HP-UX file descriptor, which establishes a connection to the file being
accessed. A file descriptor is an integer whose function is similar to a Fortran logical unit number. For
example, the following open system call (called from a C-language program) opens a file named
DATA.DAT for reading and writing, and returns the value of an HP-UX file descriptor:
#include <fcntl.h> /* definition of O_RDWR contained here */
...
fildes = open("DATA.DAT", O_RDWR)
Obtaining an HP-UX file descriptor
The Fortran intrinsic FNUM returns the HP-UX file descriptor for a given logical unit. See the program
in“File handling” on page 198 for an example of how to call the FNUM intrinsic. For information about
FNUM, see the HP Fortran Programmer's Reference.