SPL to HP C/XL Migration Guide (30231-90001)
9- 1
Chapter 9 Input/Output
This chapter discusses conversion issues that correspond to sections in
Chapter 8 of the
Systems Programming Language Reference Manual
.
Introduction to Input/Output
SPL has no input/output (I/O) statements; instead, it uses MPE V
intrinsics to perform all I/O operations.
Similarly, HP C/XL has no I/O statements; it does have its own library
header file, <stdio.h>, that provides a comprehensive set of macros and
functions for I/O capabilities, including high level formatting. HP C/
XL also has a special library header file, <mpe.h>, that provides an
interface to the MPE XL I/O intrinsic library. This arrangement allows
HP C/XL programmers to choose either HP C/XL I/O functions and macros,
MPE XL I/O intrinsics, or a combination of both.
In general, the MPE XL I/O intrinsics are identical to or extensions of
the MPE V versions. The differences are described in the
Introduction to
MPE XL for MPE V Programmers
migration guide. Consult the
MPE XL
Intrinsics Reference Manual
| for the complete specification of all MPE
XL intrinsics.
There are strong arguments in favor of adopting the HP C/XL style of I/O
operations. Programmer convenience and program portability are high on
the list. Programs that use HP C/XL library functions can usually be
transferred to HP C/HP-UX with little or no modification. The source
code changes that are required anyway to provide parameters to the MPE XL
intrinsics can just as easily be revised to use HP C/XL library functions
instead.
It is recommended that SPL programs being translated into HP C/XL adopt
as many of the HP C/XL I/O facilities as possible. Where there are
necessary operations that cannot be performed by the HP C/XL standard
library header file, <stdio.h>, MPE XL intrinsics may be declared with
the #pragma intrinsic directive and called directly.
CAUTION You cannot use the HP C/XL I/O system and another I/O system
concurrently to write data to the same disk file (except for the
stdout and stderr file streams). Please consult the
HP C/XL
Library Reference Manual
for details.