The <uio.h>
header defines two functions useful for vector I/O operations, as well as the iovec
structure they require.
Structures and Types
iovec Struct
Purpose
Defines an I/O vector; that is, a buffer address and size.
Declared In
posix/sys/uio.h
Prototype
struct iovec {
void *iov_base; size_t iov_len; }
Fields
-
iov_base
- The base address of a memory region for input or output.
-
iov_len
- The size of the memory pointed to by
iov_base
.
Functions and Macros
readv Function
Purpose
Performs the same action as read()
, but scatters the input data into the iovcnt
buffers specified by the members of the iov
array: iov[0]
, iov[1]
, ..., iov[iovcnt-1]
.
Declared In
posix/sys/uio.h
Prototype
ssize_t readv ( intd
, const struct iovec *iov
, size_tiovcnt
)
Parameters
Returns
Returns the number of bytes actually read and placed in the buffer. Zero (0) is returned if end-of-file is read. Otherwise, -1 is returned and the global variable errno
is set to indicate the error.
See Also
writev Function
Purpose
Performs the same action as write()
, but gathers the output data from the iovcnt
buffers specified by the members of the iov
array: iov[0]
, iov[1]
, ..., iov[iovcnt-1]
.
Declared In
posix/sys/uio.h
Prototype
ssize_t writev ( intd
, const struct iovec *iov
, size_tiovcnt
)
Parameters
Returns
Returns the number of bytes actually written. Otherwise, -1 is returned and the global variable errno
is set to indicate the error.