readv, writev - read or write data into multiple buffers
int readv(int filedes, const struct iovec *vector,
int writev(int filedes, const struct iovec *vector,
The readv() function reads count blocks from the file asso-
ciated with the file descriptor filedes into the multiple
buffers described by vector.
The writev() function writes at most count blocks described
by vector to the file associated with the file descriptor
The pointer vector points to a struct iovec defined in
void *iovbase; /* Starting address */
size_t iov_len; /* Number of bytes */
Buffers are processed in the order vector, vector, ...
The readv() function works just like read(2) except that
multiple buffers are filled.
The writev() function works just like write(2) except that
multiple buffers are written out.
The readv() function returns the number of bytes or -1 on
error; the writev() function returns the number of bytes
The readv() and writev() functions can fail and set errno to
the following values:
fd is not a valid file descriptor.
fd is unsuitable for reading (for readv()) or writing
buf is outside the processes' address space.
Non-blocking I/O had been selected in the open() call,
and reading or writing could not be done immediately.
Reading or writing was interrupted before any data was
It is not advisable to mix calls to functions like readv()
or writev(), which operate on file descriptors, with the
functions from the stdio library; the results will be unde-
fined and probably not what you want.