const Size size() const
Get file size.
Result write(const void *data, const Size size) const
Write the file (unbuffered)
Result read()
Read the file (buffered)
~BufferedFile()
Destructor.
const char * m_path
Path to the file.
const char * path() const
Get file path.
BufferedFile(const char *path)
Constructor.
u8 * m_buffer
Stored contents of the file.
const void * buffer() const
Get file buffer.
Size m_size
Size of the file in bytes.
C int open(const char *path, int oflag,...)
Open file relative to directory file descriptor.
C char * strerror(int errnum)
The strerror function maps the number in errnum to a message string.
C int close(int fildes)
Close a file descriptor.
C int errno
The lvalue errno is used by many functions to return error values.
#define assert(exp)
Insert program diagnostics.
#define O_RDONLY
Open for reading only.
#define O_RDWR
Open for reading and writing.
#define ERROR(msg)
Output an error message.
unsigned int Size
Any sane size indicator cannot go negative.
unsigned char u8
Unsigned 8-bit number.
The <sys/stat.h> header shall define the stat structure.
off_t st_size
For regular files, the file size in bytes.