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

Guardian Native C Library Calls (f) freopen64_guardian(3)
r Opens a text le for reading.
w Creates a new text le for writing, or opens and truncates a text le to zero
length.
a Appends (opens a text le for writing at the end of the le, or creates a text le
for writing).
r+ Opens a text le for update (reading and writing).
w+ Truncates or creates a text le for update.
a+ Appends (opens a text le for update, writing at the end of the le, or creates a
text le for writing).
rb Opens a C binary le for reading.
wb Creates a new C binary le for writing, or opens and truncates a C binary le to
zero length.
ab Appends (opens a C binary le for writing at the end of the le, or creates a C
binary le for writing).
rb+ Opens a C binary le for update (reading and writing).
wb+ Truncates or creates a C binary le for update.
ab+ Appends (opens a C binary le for update, writing at the end of the le, or
creates a C binary le for writing).
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 (such as the fseeko64(), fset-
pos64(),orrewind() functions). Also, an output operation cannot directly follow an input opera-
tion without an intervening 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, ab, a+,orab+), it is
impossible to overwrite information already in the le. You can use the fseeko64() 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.
The ANSISTREAMS pragma determines whether a text le is type 180 (C binary le) or type 101
(edit le). The Guardian version of freopen64() distinguishes between text and binary les. If
the mode parameter does not contain a b, the le is created or opened as a text le. The OSS ver-
sion of freopen64() does not distinguish between text and binary les. Text and binary les in
the OSS environment are type 180. For information on the ANSISTREAMS pragma, see the
C/C++ Programmers Guide.
527192-007 Hewlett-Packard Company 275