Next: bpipe_iochannel_write, Previous: bpipe_iochannel_open, Up: Internal Functions
read data from an I/O channel.
#include <bpipe/bpipe.h>size_t bpipe_iochannel_read( void *buf, size_t size, size_t n, IOchannel *ioc );
void *buf
- the destination buffer to fill
size_t size
- the size of an object to be read
size_t n
- the number of objects to read
IOchannel *ioc
- the I/O channel to read from
This routine reads data from an I/O channel. Because of the
idiosyncracies of the various OS's implementation of fread
,
it isn't as efficient as it can be, nor does it return as
much information as might be available.
It returns the number of objects read. Upon error it
returns ‘0’ and sets bpipe_errno
to BPEIOERR
.