The writev function is equivalent to 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]. The iovcnt argument is valid if greater than 0 and less than or equal to {IOV_MAX}, defined in <limits.h>. Each iovec entry specifies the base address and length of an area in memory from which data should be written. The writev function writes a complete area before proceeding to the next. If filedes refers to a regular file and all of the iov_len members in the array pointed to by iov are 0, writev returns 0 and has no other effect. For other file types, the behavior is unspecified. If the sum of the iov_len values is greater than SSIZE_MAX, the operation fails and no data is transferred. Upon successful completion, writev returns the number of bytes actually written. Otherwise, it returns a value of -1, the file pointer remains unchanged, and errno is set to indicate an error.