|
class ofbitstream : public obitstream
This class writes bits of data to input files.
This class inherits from the obitstream
class.
Available since: 2014/02/01 version of C++ library
Constructors | |
Constructs a new bit stream that is not attached to any file. | |
Constructs a new bit stream that writes to the specified file. | |
Methods | |
Closes the currently-opened file, if the stream is open. | |
Opens the specified file for writing. | |
Writes a single bit to the bit stream. |
ofbitstream();
open
member function.
Usage:
ofbitstream stream;
ofbitstream(const char* filename); ofbitstream(string filename);
Usage:
ofbitstream stream(filename);
void close();
Usage:
stream.close();
void open(const char* filename); void open(string filename);
fail
member function.
Usage:
stream.open(filename);
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);