Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)
Guardian Native C Library Calls (f) fopen(3)
NAME
fopen - Opens a file stream
LIBRARY
G-series native Guardian processes: $SYSTEM.SYSnn.ZCRTLSRL
G-series native OSS processes: /G/system/sysnn/zcrtlsrl
H-series native Guardian processes: $SYSTEM.ZDLLnnn.ZCRTLDLL
H-series OSS processes: /G/system/zdllnnn/zcrtldll
DESCRIPTION
The C run-time library supports two variants of the fopen() function: fopen_oss() and
fopen_guardian(). These variants support the unique file-naming conventions and structures of
the OSS and Guardian file systems, respectively. These variants support OSS
files that have a file |
offset maximum smaller than 2 gigabytes and Guardian files that have a file offset maximum |
smaller than 4 gigabytes (Guardian Format 1 files).
For the TNS C runtime library only, the header file maps calls to fopen() to the variant that
matches the target compilation environment. The target environment is set with the systype
pragma.
Explicit calls to the fopen_oss() and fopen_guardian() variants in source code are only made
when the behavior of one environment is desired from the other environment.
For a description of the fopen() OSS function and the fopen_oss( ) function, refer to the
fopen_oss(3) reference page. For a description of the fopen( ) Guardian function and the
fopen_guardian() function, see the fopen_guardian(3) reference page.
For a description of equivalent functions that support OSS files that have a file offset maximum |
larger than 2 gigabytes and Guardian files that have a file offset maximum larger than 4 gigabytes |
(Guardian Format 2 files), see the fopen64(3) reference page.
NOTES
The file offset maximum for an OSS file is established when the file is opened:
• When you use fopen64_oss(), or a function that calls this function, to open an OSS file
that has a file offset maximum of 2 gigabytes, the file is automatically converted to a file
that can grow to larger than 2 gigabytes.
• When you use fopen_oss() (and the call is not mapped to fopen64_oss()) to open a file
that is larger than 2 gigabytes, the file is treated like a small file. Subsequent operations,
such as read, write, and positioning operations, are subject to the same limits as when
accessing a file that has an offset maximum of 2 gigabytes.
The file offset maximum for an Guardian file is established when the file is opened. When you
use fopen_guardian() (and the call is not mapped to fopen64_guardian()) to open a Guardian
Format 2 file that has less than 4 gigabytes of data, the file is treated like a Guardian Format 1
file. Subsequent operations, such as read, write, and positioning operations, are subject to the
same limits as when accessing a Guardian Format 1 file (that has an offset maximum of 4 giga-
bytes). For a few functions, the OSS limit for small files of 2 gigabytes applies instead of the
Guardian limit for small files of 4 gigabytes, because file positions beyond 2 gigabytes cannot be
represented in the functions’s data structures.
527192-007 Hewlett-Packard Company 2−29