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