Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
fopen64_oss(3) OSS Library Calls Reference Manual
r Open an existing file for read-only access.
w Create a file (or truncate an existing file to length zero) and open it for write-only
access.
a Create a file (or open an existing file) and open it for append (write at the end of
the file) access.
r+ Open an existing file for update access (reading and writing).
w+ Create a file (or truncate an existing file to length zero) and open it for update
access.
a+ Create a file (or open an existing file) and open it for update access with writing
at the end of the file.
The OSS version of fopen does not distinguish between text and binary files. Text and binary
files are type 180. Specifying a value of mode that consists of an r, w,ora followed by a b indi-
cates a binary file. However, the OSS version of the fopen function ignores the b in the value of
mode.
When you open a file 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 fflush( ) function call or a file-positioning operation (fseek( ), fsetpos( ),orrewind()
function). Also, an output operation cannot directly follow an input operation without an inter-
vening flush or file-positioning operation, unless the input operation encounters the end of the
file.
When you open a file for append (that is, when the mode parameter is a or a+), it is impossible to
overwrite information already in the file. You can use the fseek( ) function to reposition the file
pointer to any position in the file, but when output is written to the file, the current file pointer is
ignored. All output is written at the end of the file and the file pointer is repositioned to the end
of the output.
If two separate processes open the same file for append, each process can write freely to the file
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 file. If the data is buffered, it is not actually
written until it is flushed.
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 file did not previously exist, upon successful
completion the fopen64( ) function marks the st_atime, st_ctime and st_mtime fields of the file
and the st_ctime and st_mtime fields of the parent directory for update. If the mode parameter is
w or w+ and the file did previously exist, upon successful completion the fopen64( )
function
marks
the st_ctime and st_mtime fi
elds of the file 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 file-naming conventions and structures of
the OSS and Guardian file 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.
2−108 Hewlett-Packard Company 527187-017