написать в файл (write on a file)
Ошибки (Error)
These functions shall fail if:
EAGAIN
The file is neither a pipe, nor a FIFO, nor a socket, the
O_NONBLOCK flag is set for the file descriptor, and the
thread would be delayed in the write() operation.
EBADF
The fildes argument is not a valid file descriptor open
for writing.
EFBIG
An attempt was made to write a file that exceeds the
implementation-defined maximum file size or the file size
limit of the process, and there was no room for any bytes
to be written.
EFBIG
The file is a regular file, nbyte is greater than 0, and
the starting position is greater than or equal to the
offset maximum established in the open file description
associated with fildes.
EINTR
The write operation was terminated due to the receipt of a
signal, and no data was transferred.
EIO
The process is a member of a background process group
attempting to write to its controlling terminal, TOSTOP is
set, the calling thread is not blocking SIGTTOU, the
process is not ignoring SIGTTOU, and the process group of
the process is orphaned. This error may also be returned
under implementation-defined conditions.
ENOSPC
There was no free space remaining on the device containing
the file.
ERANGE
The transfer request size was outside the range supported
by the STREAMS file associated with fildes.
The pwrite() function shall fail if:
EINVAL
The file is a regular file or block special file, and the
offset argument is negative. The file offset shall remain
unchanged.
ESPIPE
The file is incapable of seeking.
The write() function shall fail if:
EAGAIN
The file is a pipe or FIFO, the O_NONBLOCK flag is set for
the file descriptor, and the thread would be delayed in
the write operation.
EAGAIN
or EWOULDBLOCK
The file is a socket, the O_NONBLOCK flag is set for the
file descriptor, and the thread would be delayed in the
write operation.
ECONNRESET
A write was attempted on a socket that is not connected.
EPIPE
An attempt is made to write to a pipe or FIFO that is not
open for reading by any process, or that only has one end
open. A SIGPIPE signal shall also be sent to the thread.
EPIPE
A write was attempted on a socket that is shut down for
writing, or is no longer connected. In the latter case, if
the socket is of type SOCK_STREAM, a SIGPIPE signal shall
also be sent to the thread.
These functions may fail if:
EINVAL
The STREAM or multiplexer referenced by fildes is linked
(directly or indirectly) downstream from a multiplexer.
EIO
A physical I/O error has occurred.
ENOBUFS
Insufficient resources were available in the system to
perform the operation.
ENXIO
A request was made of a nonexistent device, or the request
was outside the capabilities of the device.
ENXIO
A hangup occurred on the STREAM being written to.
A write to a STREAMS file may fail if an error message has been
received at the STREAM head. In this case, errno is set to the
value included in the error message.
The write() function may fail if:
EACCES
A write was attempted on a socket and the calling process
does not have appropriate privileges.
ENETDOWN
A write was attempted on a socket and the local network
interface used to reach the destination is down.
ENETUNREACH
A write was attempted on a socket and no route to the
network is present.
The following sections are informative.