Writes a buffer of data to a socket or file.
Format
#include <unixio.h>
int write (int d, void *buffer, int
nbytes);
Arguments
- d
- A descriptor that must refer to a socket or file.
- buffer
- The address of contiguous storage from which the output data is
taken.
- nbytes
- The maximum number of bytes involved in the write operation.
Description
This routine attempts to write a buffer of data to a socket or
file.
See also socket in this section.
Return Values
x | The number of bytes written to the
socket or file. |
0 | Indicates
an error. |
-1 | Indicates an
error; errno is set to one of the following:
- EBADF - The d argument is not a valid descriptor
open for writing.
- EPIPE - An attempt was made to write to a socket that is
not open for reading by any process.
- EFAULT - Part of the array pointed to by iov or data to
be written to the file points outside the process's allocated
address space.
- EWOULDBLOCK - The NBIO (nonblocking) flag is set for the
socket descriptor and the process would be delayed in the write
operation.
- EINVAL - The nbytes argument is negative.
|
Previous Page | Next Page | Table of Contents | Index