BinaryFileWriter: interface for writing to binary files, bit by bit or byte by byte.
More...
#include "binary_file_writer.h"
BinaryFileWriter: interface for writing to binary files, bit by bit or byte by byte.
Wraps an ofstream in binary mode.
- Author
- Chase Geigle
- Date
- Sumer 2012
◆ BinaryFileWriter()
BinaryFileWriter::BinaryFileWriter |
( |
const std::string & |
fileName | ) |
|
Constructs a new BinaryFileWriter by opening the given filename.
- Parameters
-
fileName | File to be opened. |
◆ ~BinaryFileWriter()
BinaryFileWriter::~BinaryFileWriter |
( |
| ) |
|
Destroys an BinaryFileWriter: the destructor here ensures that all remaining bits are written to the file before closing the file.
If the file was already closed, nothing is done.
◆ writeBit()
void BinaryFileWriter::writeBit |
( |
bool |
bit | ) |
|
Writes the next bit of the file.
- Parameters
-
bit | The bit to be written. |
◆ writeByte()
void BinaryFileWriter::writeByte |
( |
char |
byte | ) |
|
Writes the next byte to the file.
- Parameters
-
byte | The byte to be written. |
◆ close()
void BinaryFileWriter::close |
( |
| ) |
|
◆ writeCurrentByte()
void BinaryFileWriter::writeCurrentByte |
( |
| ) |
|
|
private |
Writes the current byte to the file.
◆ file
◆ currentByte
char BinaryFileWriter::currentByte |
|
private |
The current byte to write bits into.
◆ currentBit
int BinaryFileWriter::currentBit |
|
private |
the current bit within the currentByte that is being written.
The documentation for this class was generated from the following files: