LibCore: Add CFileStreamReader, a simple streaming CFile reader.

This is extremely barebones right now, but can be used to easily read binary
data from a CFile piece by piece.
This commit is contained in:
Andreas Kling 2019-07-27 16:37:48 +02:00
parent be1025c03f
commit a292d8cd5a
Notes: sideshowbarker 2024-07-19 13:01:41 +09:00
3 changed files with 41 additions and 0 deletions

View file

@ -22,6 +22,13 @@ const char* CIODevice::error_string() const
return strerror(m_error);
}
int CIODevice::read(u8* buffer, int length)
{
auto read_buffer = read(length);
memcpy(buffer, read_buffer.data(), length);
return read_buffer.size();
}
ByteBuffer CIODevice::read(int max_size)
{
if (m_fd < 0)