There are five bottom layer functions for a stream: read, write, flush, seek and close. However, not all of these functions are needed for every stream:
seek
function is not required when the seek_type
is
QP_SEEK_ERROR
.
read
function is only required for an input stream.
write
function is only required for an output stream.
flush
function is not required when the flush_type
is
QP_FLUSH_ERROR
.
close
function should be supplied for every stream.
These functions usually only operate on the specific
fields of a particular user-defined stream. (i.e. Fields other than
the first field in a user-defined stream structure.) The errno
field and magic
field in QP_stream
part may also be
maintained by the bottom layer functions. The mode
field and
max_reclen
field are also typically accessed by the bottom layer
functions.
Except for the read function, all the bottom layer functions
return QP_SUCCESS
upon success, and return QP_ERROR
and assign an error code to the errno
field upon failure.
These functions are described further in subsequent
sub-sections.