C/C++ Programmer's Guide (G06.27+, H06.03+)

Table Of Contents
Introduction to HP C and C++ for NonStop Systems
HP C/C++ Programmer’s Guide for NonStop Systems429301-010
1-19
Writing Portable Programs
°
The ANSI model, which uses FILE pointers to identify files
°
The alternate or UNIX-style model, which uses file descriptors to identify files
With two file-reference models available, you can select the model whose I/O
services best suit the needs of your application. For more details, see Section 4,
Using the C Run-Time Library.
Access to Guardian system procedures
Call procedures in the Guardian system library using the cextdecs header file in
the Guardian environment or the cextdecs.h header file in the OSS environment
and PC environment.
Access to Open System Services system calls and library calls
Call routines that are part of the Open System Services library.
Access to procedures written in other languages
TNS programs can call procedures written in C, C++, TNS COBOL, FORTRAN,
D-series Pascal, and TAL. Native programs can call procedures written in C, C++,
native COBOL, and pTAL.
Access to a NonStop SQL/MP database or a NonStop SQL/MX database
Your TNS/R native C or C++ program can interface to a NonStop SQL/MP or
NonStop SQL/MX database using embedded SQL.
Fault-tolerant programs
Write fault-tolerant process pairs using the active backup programming model.
Writing Portable Programs
A portable application is an application designed using open, industry-standard
languages, application program interfaces (APIs), and middleware, such as the C
language and POSIX.1 API. A portable application can be moved between hardware
systems and middleware environments from different vendors. This subsection
provides guidelines for writing portable C programs.
Complying With Standards
Writing programs to international standards enables you to move them between
different hardware and software environments with little effort. Write your C programs
to comply with the ISO/ANSI C standard: ISO/IEC 9899:1990, Programming
Languages–C. For a complete description of ANSI C, see ANSI X3.159.
If you are writing a program to run in the Open System Services (OSS) environment,
you should also comply with these standards:
X/Open Common Applications Environment (CAE) Specification, System Interfaces
and Headers, Issue 4, Version 2, 1994.