1 #ifndef BYTE_FILER_CLASS
2 #define BYTE_FILER_CLASS
52 byte_filer(
const char *fname,
const char *permissions);
Provides a dynamically resizable ASCII character string.
A very common template for a dynamic array of bytes.
Provides file managment services using the standard I/O support.
int getline(basis::abyte *buffer, int desired_size)
reads a line of text (terminated by a return) into the "buffer".
static size_t file_size_limit()
returns the maximum size that seek and length can support.
int write(const basis::abyte *buffer, int buffer_size)
writes "buffer_size" bytes into the file from "buffer".
void * file_handle()
provides a hook to get at the operating system's file handle.
byte_filer()
constructs an object that doesn't access a file yet.
void close()
shuts down the open file, if any.
@ FROM_START
offset is from the beginning of the file.
@ FROM_CURRENT
offset is from current cursor position.
@ FROM_END
offset is from the end of the file.
bool seek(int where, origins origin=FROM_START)
places the cursor in the file at "where", based on the "origin".
const basis::astring & name() const
returns the file name that the object is operating on.
int read(basis::abyte *buffer, int buffer_size)
reads "buffer_size" bytes from the file into "buffer".
bool eof()
returns true if the cursor is at (or after) the end of the file.
size_t tell()
returns the current position within the file, in terms of bytes.
void flush()
forces any pending writes to actually be saved to the file.
size_t length()
returns the file's total length, in bytes.
bool truncate()
truncates the file after the current position.
bool good()
returns true if the file seems to be in the appropriate desired state.
bool open(const basis::astring &fname, const basis::astring &permissions)
opens a file with "fname" and "permissions" as in the constructor.
Provides operations commonly needed on file names.
Constants and objects used throughout HOOPLE.
unsigned char abyte
A fairly important unit which is seldom defined...
A platform independent way to obtain the timestamp of a file.