HP C/iX Library Reference Manual (30026-90004)

174 Chapter5
HP C/iX Library Function Descriptions
freopen
The
type
parameter points to a character string beginning with one of the following
sequences:
r Open or create text stream for reading.
w Open or create text stream for writing. Truncate to zero length.
a Open or create text stream in append mode. All writes are at end-of-file.
rb Open or create binary stream for reading.
wb Open or create binary stream for writing. Truncate to zero length.
ab Open or create binary stream in append mode. All writes are at end-of-file.
r+ Open or create text stream for update (reading and writing).
w+ Open or create text stream for update. Truncate to zero length.
a+ Open or create text stream for append update (read anywhere but all
writes at end-of-file).
r+b or rb+ Open or create binary stream for update (reading and writing).
w+b or wb+ Open or create binary stream for update. Truncate to zero length.
a+b or ab+ Open or create binary stream for append update (reading anywhere but all
writes to end-of-file).
NOTE
If you are linking with the POSIX/iX library, freopen() parses
type
and
ignores all cases where b is specified. An MPE byte stream format file is
opened and a binary stream is associated with it. In addition, all other
type
options specified below are invalid.
If you are linking with the HP C/iX library, there are several enhancements that provide
greater control in the MPE file environment. These options should follow the standard
options in the
type
string. Spaces can be used in the
type
string to improve the readability
of the file's open type. Notice that the case of the option is important. An uppercase B is
different from a lowercase b.
These options are the same options that are used by the fopen() function. For a detailed
description of these options, refer to the description of fopen().
Bl
n
The Bl option specifies the blocking factor to use if this call to freopen()
creates the file. The option character is followed by an integer that
indicates the blocking factor. If the Bl option is not specified, then the
default is one record per block.
Bs If the Bs option is specified, the file is opened or created as a byte stream
file. This is the only required option for opening byte stream files. The
maximum file size for a byte stream file is two gigabytes. If specified, the
Rn option is ignored. The S
n
option can be used to reset the file size. This
option is mutually exclusive with the V option. If the Bs or V options are
not specified, the file is created with an MPE fixed-length record format.