readv, writev - read or write a vector
#include <sys/uio.h>
int readv(int fd, const struct iovec * vector, int count);
int writev(int fd, const struct iovec * vector, int count);
struct iovec { ptr_t iov_base; /* Starting address. / size_t iov_len; / Length in bytes. */ };
readv(2) reads data from file descriptor fd, and puts the result in the buffers described by vector. The number of buffers is specified by count. The buffers are filled in the order specified. Operates just like read except that data is put in vector instead of a contiguous buffer.
writev writes data to file descriptor fd, and from the buffers described by vector. The number of buffers is specified by count. The buffers are used in the order specified. Operates just like write except that data is taken from vector instead of a contiguous buffer.
On success readv returns the number of bytes read. On success writev returns the number of bytes written. On error, -1 is returned, and errno is set appropriately.
Other errors may occur, depending on the object connected to fd.
4.4BSD (the readv and writev functions first appeared in BSD 4.2), Unix98. Linux libc5 uses size_t as the type of the count parameter, which is logical but non-standard.
6 pages link to readv(2):