HPlogo MPE/iX Developer's Kit Reference Manual Volume I: HP 3000 MPE/iX Computer Systems > Chapter 2 Using the POSIX/iX Library

Input/Output Considerations

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

The POSIX/iX library provides two mechanisms to operate on MPE/iX files:

  • streams

  • file descriptors

Both streams and file descriptors serve as "handles" to the underlying file.

MPE/iX supported many different file types and file record formats; however, the POSIX/iX library supports operations only on files whose MPE/iX record format is byte-stream (referred to as byte-stream files). All files created or opened through POSIX/iX library functions are MPE/iX byte-stream files. Attempts to open an MPE/iX file whose type is other than byte-stream results in an error. This applies to emulators.

The HP C/iX Library Reference Manual (30026-90001) describes the behavior of C library functions when operating on various MPE/iX file types. You should ignore these references and pay attention only to those sections that describe the behavior of library functions when they are operating on MPE/iX byte-stream files.

Streams

Streams are abstractions over file descriptors in order to provide buffered I/O defined by ANSI C. ANSI C defines two types of streams, the text stream and the binary stream; however, the POSIX/iX library does not distinguish between text and binary streams. For more information about streams, refer to the HP C/iX Library Reference Manual (30026-90001).

NOTE: The term "stream" should not be confused with the MPE/iX file whose record format is "byte-stream".

File descriptors

The POSIX.1 standard defines an additional method of accessing a file, through the use of file descriptors. A file descriptor is a per-process nonnegative integer used to identify an open file. For example, when creating or opening a file using the open() function, a file descriptor whose type is integer is associated with the underlying file description and returned to the calling process. All subsequent accesses of that file are performed through the file descriptor. The buffered I/O performed for streams is not performed when accessing a file through its file descriptor.

Feedback to webmaster