Node:binfbase, Next:, Up:File streams



binfbase

binfbase provides the common base class for all file I/O binary streams. It defines important data types, variables and methods.

Header file: binfile.h

Public methods:

binfbase()
The constructor.
~binfbase()
The destructor. Automatically closes an eventually open stream.
virtual void open(const char *filename, const Mode mode)
virtual void open(const std::string &filename, const Mode mode)
Two versions of an abstract virtual method to open a binary file stream. filename is the filename of the file to open and mode specifies in which mode to do so. Refer to the list of data types for this class for more information on this argument. You can combine multiple mode flags together, using the | operator.
void close()
Method to explicitly close the stream.
void seek(long pos, Offset offs = Set)
long pos()
Implementation of the abstract virtual methods, inherited from binio. Look there for reference.

Public data types and variables:

enum ModeFlags
Enumeration of all defined file stream open mode flags, defining how a file should be opened when the open() method is called. This type defines the following flags:
Append
Open the stream for appending. The stream pointer is positioned at the end of the stream. Also, do not truncate a file to zero length, if it already exists.
NoCreate
Do not automatically create a nonexistant file on first access and fail instead. Also, do not truncate a file to zero length, if it already exists.

Mode
Type of the variable to hold the mode specification flags that are passed to one of the open() methods to open a file stream. Refer to enum ModeFlags above for information on what flags are defined.

Protected data types and variables:

FILE *f
Pointer to the currently opened file of this stream.