Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/w/writev.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/w/writev.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/w/writev.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/w/writev.html on line 8
Write bytes to a file
#include <sys/uio.h>
ssize_t writev( int fildes,
const iov_t* iov,
int iovcnt );
- fildes
- The file descriptor for the file you want to write in.
- iov
- An array of iov_t objects that contain the data that you
want to write.
- iovcnt
- The number of elements in the array.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The writev() function 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].
For writev(), the iov_t structure contains the
following members:
- iov_base
- Base address of a memory area from which data should be written.
- iov_len
- The length of the memory area.
The writev() function always writes a complete area before proceeding to the
next.
The maximum number of entries in the iov array is
UIO_MAXIOV.
|
Note that writev() ignores advisory locks that may
have been set by the fcntl()
function. |
If writev() is interrupted by a signal before it has written any
data, it returns a value of -1, and errno is set to
EINTR. However, if writev() is interrupted by a signal
after it has successfully written some data, it will return the number
of bytes written.
For more details, see the
write() function.
The number of bytes written, or -1 if an error occurs
(errno
is set).
- EAGAIN
- The O_NONBLOCK flag is set for the file descriptor, and
the process would be delayed in the write operation.
- EBADF
- The file descriptor, fildes, isn't a valid file descriptor
open for writing.
- EFBIG
- The file is a regular file, where nbytes is greater than 0, and
the starting position is greater than or equal to the offset maximum
associated with the file.
- EINTR
- The write operation was interrupted by a signal, and either no data
was transferred, or the resource manager responsible for that file doesn't
report partial transfers.
- EINVAL
- The iovcnt argument is less than or equal to 0, or greater than
UIO_MAXIOV.
- EIO
- A physical I/O error occurred (for example, a bad block on a disk). The
precise meaning is device-dependent.
- ENOSPC
- There is no free space remaining on the device containing the file.
- ENOSYS
- The write() function isn't implemented for the filesystem specified
by filedes.
- EPIPE
- An attempt was made to write to a pipe (or FIFO) that isn't open for
reading by any process. A SIGPIPE signal is also sent to
the process.
POSIX 1003.1 XSI
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
close(),
creat(),
dup(),
dup2(),
errno,
fcntl(),
lseek(),
open(),
pipe(),
read(),
readv(),
select(),
write()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/w/writev.html on line 244
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/w/writev.html on line 244