The file reader provides features to write bytes into a binary file.
More...
#include <FileWriter.hpp>
The file reader provides features to write bytes into a binary file.
◆ FileWriter()
rl::FileWriter::FileWriter |
( |
const FilePath & |
path, |
|
|
bool |
truncate = false |
|
) |
| |
|
explicit |
Creates and opens a file with writing permissions.
If the file does not exist, it is created. If the file already exists, the original content can be either kept or discarded.
- Parameters
-
path | The path to the file |
truncate | true to discard the original content, false to keep it |
◆ open()
void rl::FileWriter::open |
( |
const FilePath & |
path, |
|
|
bool |
truncate = false |
|
) |
| |
Opens a file with writing permissions.
If the file does not exist, it is created. If the file already exists, the original content can be either kept or discarded.
- Parameters
-
path | The path to the file |
truncate | true to discard the original content, false to keep it |
◆ operator bool()
rl::FileWriter::operator bool |
( |
| ) |
const |
Tells if the file is in a good state.
- Returns
true
if no errors occurred while writing into the file, false
if something went wrong
◆ write() [1/2]
void rl::FileWriter::write |
( |
const ByteStream & |
buffer | ) |
|
Writes a chunk of bytes into the file.
- Parameters
-
buffer | The data stream containing the bytes that are to be written |
◆ write() [2/2]
void rl::FileWriter::write |
( |
const ByteStream & |
buffer, |
|
|
std::streampos |
pos |
|
) |
| |
Writes a chunk of bytes into a specific position in the file.
- Parameters
-
buffer | The data stream containing the bytes that are to be written |
pos | The position of the file cursor |
The documentation for this class was generated from the following file: