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

158 Chapter5
HP C/iX Library Function Descriptions
fopen
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, the fopen function only creates
or opens byte stream files. Attempting to open any other file type results in an
error.
When fopen() parses
mode
, all cases of b are ignored in the standard options,
and an MPE byte stream format file is opened and a binary stream is
associated with it. In addition, all other
mode
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
mode
string. Spaces may be used in the
mode
string to improve the
readability of the file's open mode. Notice that the case of the option is important. An
upper case B is different from a lower case b.
Bl
n
The Bl option specifies the blocking factor to use if this call to fopen()
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.
Bu
n
The Bu option specifies the number of buffers to be allocated to this file. If
the Bu option is not specified, the default is 2.
C If the C option is specified, then the file will accept carriage control
information. The default is to not have carriage control.
Df
n
The Df option specifies the final disposition of the file after the file is