For the most part, you will want to use libbinio to access normal binary files on your filesystem.
This is what the
binfstream related classes are for. To use
them, you first have to include the file
binfile.h within your
This file contains four class declarations -
binfbase is a base class for the others and
normally not used by an ordinary libbinio user. This leaves us with
three usable classes.
To create a binary stream on a file, just instantiate one of the three classes, according to what I/O facilities the stream should provide (see Basics for information on the class naming conventions).
To open a file, you use the
method of one of the classes. filename is a string (both C style
ASCIIZ strings and STL
string objects can
be passed, if supported by your compiler) containing the name of the
file to open. Additionally, you can pass a mode argument to
specify a special way to open the file - this is described
later. There's also a special constructor, provided for convenience,
that opens up a file automatically when the object is created. It has
exactly the same syntax as
After usage, you can explicitly close the file with the
method. It is always a good idea to do this explicitly, though not
needed because the file automatically will be closed on object