|
class obitstream : public std::ostream
This base class writes bits of data to various output sources.
This is an abstract base class that inherits from the standard C++ ostream
class.
You are not likely to want to construct an obitstream
directly.
Instead, you should probably construct an ofbitstream
to write to a file, or an ostringbitstream
to write bits into the bytes of a string buffer.
Available since: 2014/02/01 version of C++ library
Methods | |
Writes a single bit to the bit stream. |
void writeBit(int bit);
bit
parameter is not 0
or 1
.
(Note: A common bug is to pass a char
value of '0'
or '1'
; these are character literals that have the ASCII integer values of 48 and 49 respectively.
The char
values of '0'
and '1'
are not the same as the int
values 0
and 1
.)
Usage:
stream.writeBit(bit);