mirror of
https://github.com/davidgiven/fluxengine.git
synced 2025-10-31 11:17:01 -07:00
Writing files works in fatfs.
This commit is contained in:
13
lib/bytes.cc
13
lib/bytes.cc
@@ -128,6 +128,19 @@ uint8_t& Bytes::operator [] (unsigned pos)
|
||||
return (*_data)[pos];
|
||||
}
|
||||
|
||||
Bytes Bytes::readFromFile(const std::string& filename)
|
||||
{
|
||||
Bytes bytes;
|
||||
ByteWriter bw(bytes);
|
||||
|
||||
std::ifstream f(filename);
|
||||
if (!f)
|
||||
Error() << fmt::format("cannot open '{}': {}", filename, strerror(errno));
|
||||
bw += f;
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
Bytes Bytes::slice(unsigned start, unsigned len) const
|
||||
{
|
||||
start += _low;
|
||||
|
||||
Reference in New Issue
Block a user