int <flush function>(qpstream, bufptr, sizeptr) QP_stream *qpstream; unsigned char **bufptr; size_t *sizeptr; Return Values: QP_SUCCESS QP_ERROR
The parameters and the return values of the flush function have the
same syntax and the same meaning as the write function. The write
function may buffer the output record without writing the record out.
The flush function should write out the output record immediately when
it is called. The middle layer function will not call the write
function with an empty record (*sizeptr
is zero), but the flush
function may be called with an empty record passed in. In general,
the flush function can be the same as write function unless the write
function buffers output records. An output stream needs a bottom
layer flush function only if flush_type
of the stream is not
FLUSH_ERROR
.
In our example, the bottom layer write function does not buffer output record and it can also handle writing an empty record, so the bottom layer flush function is the same as the write function.