C/C++ Programmer's Guide (G06.25+)
Using the C Run-Time Library
HP C/C++ Programmer’s Guide for NonStop Systems—429301-008
4-10
Environment-Specific Functions
Environment-Specific Functions
There are several file-system functions that allow you to operate on a file in the
opposite environment without writing and compiling a separate module for that
environment. These functions are fopen(), freopen(), remove(), rename(),
tmpfile(), and tmpnam(). Each of these functions has environment-specific
variants with suffixes to indicate which type of file you want to operate on. For
example, fopen_guardian() opens a Guardian file in an OSS module and
fopen_oss() opens an OSS file in a Guardian module.
For details, refer to the Open System Services Programmer’s Guide.
Changes Required to Interoperable Compilation Modules at D44
At the D44 release, preexisting TNS/R native C programs that call any of the following
functions to access files in the OSS environment might need to be recompiled with a
native C compiler:
fopen()
fopen_oss()
freopen()
freopen_oss()
remove()
remove_oss()
rename()
rename_oss()
tmpnam()
tmpnam_oss()
tmpfile()
tmpfile_oss()
After the D44 release, each of these functions has a Guardian variant, such as
fopen_guardian(), and each has an OSS variant, such as fopen_oss().
Recompilation is required for compilations made using a compiler released before D44
(G04) if the execution environment is to be D44 or later (G04 or later).
You do not need to recompile Guardian TNS/R native programs that call these
functions to access Guardian files, and OSS programs that call these functions to
access OSS files.
Note. If a TNS module calls any of the environment-specific variants, the feature-test macro
_INTEROPERABLE must be specified when the module is compiled. Specifying
_INTEROPERABLE allows subsequent I/O function calls to know which type of I/O stream they
are operating on.