Node:File stream classes, Previous:binfbase, Up:File streams



File stream classes

The binary file streams consist of the classes binifstream, binofstream and binfstream. They all inherit the interface from both binfbase and binistream and/or binostream. Refer to the class reference of these classes for more information on the interface instead.

binifstream provides an input-only binary file stream. It is inherited from binistream. The open() method of this class ignores all passed mode arguments, the open mode is always NoCreate. The stream pointer is always positioned at the beginning of the stream and no files will ever be created, if they don't exist.

binofstream provides an output-only binary file stream. It is inherited from binostream. The default open mode is 0. A file is truncated to zero length or created if it did not exist previously. The stream is positioned at the beginning of the file. The NoCreate mode flag has no effect with the open() method of this class. Only Append is honored, positioning the stream at the end of the file and not truncating it. The file is still created, if it did not exist.

binfstream provides an input and output supporting binary file stream. It is inherited from both binifstream and binofstream. The default open mode is 0. A file is truncated to zero length or created if it did not exist previously. The stream is positioned at the beginning of the file. All mode arguments are valid with the open() method of this class. Refer to the list of public data types and variables of the binfbase class for more information on their meaning.

All three classes define an extra convenience constructor that has the same syntax as the open() method and automatically open the specified file on object construction.

For your information, here is a list of some important redefined methods of these classes, as explained above:

Header file: binfile.h

Public methods:

binifstream()
binofstream()
binfstream()
All standard constructors.
~binifstream()
~binofstream()
~binfstream()
All standard destructors. They all automatically close an eventually open stream, on object deconstruction.
binifstream(const char *filename, const Mode mode = NoCreate)
binifstream(const std::string &filename, const Mode mode = NoCreate)
Convenience constructors of the input-only stream class. Refer to the description of the open() method in the list of public methods of the binfbase class for syntax information.
binofstream(const char *filename, const Mode mode = 0)
binofstream(const std::string &filename, const Mode mode = 0)
Convenience constructors of the output-only stream class. Refer to the description of the open() method in the list of public methods of the binfbase class for syntax information.
binfstream(const char *filename, const Mode mode = 0)
binfstream(const std::string &filename, const Mode mode = 0)
Convenience constructors of the input and output supporting stream class. Refer to the description of the open() method in the list of public methods of the binfbase class for syntax information.