читать из файла (read from 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 read operation.
EBADF
The fildes argument is not a valid file descriptor open
for reading.
EBADMSG
The file is a STREAM file that is set to control-normal
mode and the message waiting to be read includes a control
part.
EINTR
The read operation was terminated due to the receipt of a
signal, and no data was transferred.
EINVAL
The STREAM or multiplexer referenced by fildes is linked
(directly or indirectly) downstream from a multiplexer.
EIO
The process is a member of a background process group
attempting to read from its controlling terminal, and
either the calling thread is blocking SIGTTIN or the
process is ignoring SIGTTIN or the process group of the
process is orphaned. This error may also be generated for
implementation-defined reasons.
EISDIR
The fildes argument refers to a directory and the
implementation does not allow the directory to be read
using read() or pread(). The readdir() function should be
used instead.
EOVERFLOW
The file is a regular file, nbyte is greater than 0, the
starting position is before the end-of-file, and the
starting position is greater than or equal to the offset
maximum established in the open file description
associated with fildes.
The pread() 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 read() 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 read 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
read operation.
ECONNRESET
A read was attempted on a socket and the connection was
forcibly closed by its peer.
ENOTCONN
A read was attempted on a socket that is not connected.
ETIMEDOUT
A read was attempted on a socket and a transmission
timeout occurred.
These functions may fail if:
EIO
A physical I/O error has occurred.
ENOBUFS
Insufficient resources were available in the system to
perform the operation.
ENOMEM
Insufficient memory was available to fulfill the request.
ENXIO
A request was made of a nonexistent device, or the request
was outside the capabilities of the device.
The following sections are informative.