COHERENT manpages

This page displays the COHERENT manpage for read() [Read from a file].

List of available manpages
Index


read() -- System Call (libc)

Read from a file
#include <unistd.h>
int read(fd, buffer, n)
int fd; char *buffer; int n;

read() reads up  to n bytes of data from  the file descriptor fd and writes
them into  buffer. The amount of  data actually read may  be less than that
requested if read() detects EOF. The data are read beginning at the current
seek position  in the  file, which  was set by  the most  recently executed
read() or lseek() routine.  read()  advances the seek pointer by the number
of characters read.

If all goes well, read() returns the number of bytes read; thus, zero bytes
signals the  end of the file.   It returns -1 if an  error occurs, e.g., fd
does not describe an open file, or if buffer contains an illegal address.

Example

For an example of how to use this function, see the entry for open().

See Also

libc,
unistd.h
POSIX Standard, §6.4.1

Notes

read()  is a  low-level call  that  passes data  directly to  COHERENT.  It
should not be mixed with the STDIO routines fread(), fwrite(), or fopen().