Guardian Native C Library Calls Reference Manual (G06.28+, H06.05+)

Guardian Native C Library Calls (f) fopen64_oss(3)
r Open an existing le for read-only access.
w Create a le (or truncate an existing le to length zero) and open it for write-only
access.
a Create a le (or open an existing le) and open it for append (write at the end of
the le) access.
r+ Open an existing le for update access (reading and writing).
w+ Create a le (or truncate an existing le to length zero) and open it for update
access.
a+ Create a le (or open an existing le) and open it for update access with writing
at the end of the le.
The OSS version of fopen does not distinguish between text and binary les. Text and binary
les are type 180. Specifying a value of mode that consists of an r, w,ora followed by a b indi-
cates a binary le. However, the OSS version of the fopen function ignores the b in the value of
mode.
When you open a le for update, you can perform both input and output operations on the result-
ing stream. However, an input operation cannot directly follow an output operation without an
intervening fush( ) function call or a le-positioning operation (fseek(), fsetpos( ),orrewind()
function). Also, an output operation cannot directly follow an input operation without an inter-
vening ush or le-positioning operation, unless the input operation encounters the end of the
le.
When you open a le for append (that is, when the mode parameter is a or a+), it is impossible to
overwrite information already in the le. You can use the fseek() function to reposition the le
pointer to any position in the le, but when output is written to the le, the current le pointer is
ignored. All output is written at the end of the le and the le pointer is repositioned to the end
of the output.
If two separate processes open the same le for append, each process can write freely to the le
without destroying the output being written by the other. The output from the two processes is
intermixed in the order in which it is written to the le. If the data is buffered, it is not actually
written until it is ushed.
When opened, a stream is fully buffered if and only if it does not refer to an interactive device.
The error and End-of-File indicators for the stream are cleared.
If the mode parameter is w, a, w+,ora+ and the le did not previously exist, upon successful
completion the fopen64( ) function marks the st_atime, st_ctime and st_mtime elds of the le
and the st_ctime and st_mtime elds of the parent directory for update. If the mode parameter is
w or w+ and the le did previously exist, upon successful completion the fopen64( ) function
marks the st_ctime and st_mtime elds of the le for update.
Interoperability Variants
The C run-time library supports two variants of the fopen64() function: fopen64_oss() and
fopen64_guardian(). The variants support the unique le-naming conventions and structures of
the OSS and Guardian le systems, respectively.
Explicit calls to the fopen64_oss() and fopen64_guardian() variants in source code are only
made when the behavior of one environment is desired from the other environment.
fopen64_oss() is functionally identical to the fopen64( ) function of the OSS environment. It is
the same as setting systype oss at compile time. systype oss is the default setting for c89
in the OSS environment and on UNIX workstations.
527192-007 Hewlett-Packard Company 235