Node:Wrapping around iostream, Next:, Previous:Alien architectures, Up:Usage

Wrapping around iostream

libbinio provides a set of classes, called binwstream, biniwstream and binowstream, that can be wrapped around an already existing stream from the standard or traditional C++ iostream library.

To do this, you just have to pass a pointer to the original stream object from the iostream library to the constructor of the appropriate binwstream class. Of course, you have to match an input stream from the iostream library to an input stream from libbinio and analogous for the output-only streams. The class framework will prevent you from mismatching them. You can, however, wrap an unidirectional binary stream around a bidirectional stream from the iostream library.

There is one important thing you have to remember: If you plan to wrap a binary stream around an iostream stream, always open the iostream stream with the ios::bin mode flag set! This will prevent some operating systems (namely, MS-DOS and Windows) from doing nasty implicit interpretation on the streams. This definitly will impose problems when you try to read or write the binary stream.

All other flags, you set when opening the original iostream stream, can indirectly have effect on the operations you do on the wrapped binary stream.