Guardian Native C Library Calls Reference Manual (G06.28+, H06.04+)
fopen_oss(3) Guardian Native C Library Calls Reference Manual
NAME
fopen_oss - Opens a stream (OSS fopen( ) function)
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
SYNOPSIS
#include <stdio.h>
FILE ∗∗fopen(
const char ∗∗path,
const char ∗∗mode);
FILE ∗∗fopen_oss(
const char ∗∗path,
const char ∗∗mode);
PARAMETERS
path Points to a character string that contains the name of the file to be opened. If the
final component of the path parameter specifies a symbolic link, the link is
traversed and pathname resolution continues.
mode Points to a character string that controls whether the file is opened for reading
(r), writing (w), or appending (a) and whether the file is opened for updating (+).
DESCRIPTION
The fopen( ) OSS function and fopen_oss( ) function open the file named by the path parameter
and associate a stream with it, returning a pointer to the FILE structure of this stream.
These functions are identical in the OSS environment. Unless otherwise noted, this reference
page uses fopen() to refer to both the fopen( ) OSS function and fopen_oss( ) function.
The mode parameter controls the access allowed to the stream. It can have one of the following
values:
r Opens the file for reading.
w Creates a new file for writing, or opens and truncates a file to zero length.
a Appends (opens a file for writing at the end of the file, or creates a file for writ-
ing).
r+ Opens a file for update (reading and writing).
w+ Truncates or creates a file for update.
a+ Appends (opens a file for update, writing at the end of the file, or creates a file for
writing).
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 a r, w,ora followed by a b indi-
cates a binary file. OSS fopen 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 output operation cannot be directly followed by an input operation
without an intervening fflush() function call or a file positioning operation (fseek(), fsetpos(),or
rewind() function). Also, an input operation cannot be directly followed by an output operation
without an intervening flush or file positioning operation, unless the input operation encounters
2−30 Hewlett-Packard Company 527192-005