V8/usr/man/man2/read.2
.TH READ 2
.SH NAME
read \- read from file
.SH SYNOPSIS
.nf
.B read(fildes, buffer, nbytes)
.B char *buffer;
.fi
.SH DESCRIPTION
.I Read
causes data to be read from the open file associated with the file descriptor.
.I Buffer
is the location of
.I nbytes
contiguous
bytes into which the input will be placed.
It is not guaranteed
that all
.I nbytes
bytes will be read; for example
if the file refers to a terminal at most one line
will be returned.
In any event the number of characters read is returned.
.PP
A return value of 0 is
conventionally interpreted as end of file.
If more data is subsequently written on the open file by
another process, then a further
.I read
will return it.
.PP
.SH "SEE ALSO"
open(2), creat(2), dup(2), pipe(2), select(2)
.SH DIAGNOSTICS
As mentioned,
0 is returned when the end of the file has been reached.
If the read was otherwise unsuccessful
the return value is \-1.
Many conditions
can generate an error:
physical I/O errors, bad buffer address,
preposterous
.I nbytes,
file descriptor not that of
an input file.