Saturday, February 18, 2012

writev system call

This function is known as scatter write function. They are designated that way because these functions can write from many buffers in one atomic operation. The function prototypes for these functions are provided as follows:

#include <sys/uio.h>

int writev(int fd, const struct iovec *vector, int count);

This function take three arguments, which are
  • The file descriptor fd to read or write upon. 
  • The I/O vector (vector) to use for reading or writing.
  • The number of vector elements (count) to use.
The return value for these functions are the number of bytes written for writev(2). If an error occurs, -1 is returned and errno holds the error code for the failure. Note that like other I/O functions, the error EINTR can be returned to indicate that it was interrupted by a signal.


Example:
using writev

See Also:

No comments:

Post a Comment