READ
Section: Linux Programmer's Manual (2)
Updated: 23 July 1993
Index
Return to Main Contents
NAME
read - read from a file descriptor
SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
int read(int fd, char *buf, size_t count);
DESCRIPTION
read
reads up to
count
bytes from file descriptor
fd
into the buffer starting at
buf.
RETURN VALUE
On success, the number of bytes read are returned (zero indicates end of
file). On error, -1 is returned, and
errno
is set appropriately.
ERRORS
- EINTR
-
The call was interrupted by a signal before any data was read.
- EAGAIN
-
Non-blocking I/O has been selected using
O_NONBLOCK
and no data was immediately available for reading.
- EISDIR
-
fd
refers to a directory.
- EBADF
-
fd
is not a valid file descriptor or is not open for reading.
- EINVAL
-
fd
is attached to an object which is unsuitable for reading.
- EFAULT
-
buf
is outside your accessible address space.
Other errors may occur, depending on the object connected to
fd.
CONFORMING TO
SVID, AT&T, POSIX, X/OPEN, BSD 4.3
SEE ALSO
readdir(2), write(2), write(2), fcntl(2), close(2),
lseek(2),
select(2), readlink(2), ioctl(2), fread(3).
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- RETURN VALUE
-
- ERRORS
-
- CONFORMING TO
-
- SEE ALSO
-
This document was created by
man2html,
using the manual pages.
Time: 12:25:25 GMT, March 22, 2025