

read()                 COHERENT System Call                read()




Read from a file

iinntt rreeaadd(_f_d, _b_u_f_f_e_r, _n) iinntt _f_d; cchhaarr *_b_u_f_f_e_r; iinntt _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 advan-
ces the seek pointer by the number of characters read.

***** Example *****

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

***** See Also *****

COHERENT system calls, STDIO

***** Diagnostics *****

With a  successful call, read  returns the number  of bytes read;
thus, zero bytes  signals the end of the file.   It returns -1 if
an error occurs, such as bad file descriptor, bad buffer address,
or physical read error.

***** Notes *****

read is  a low-level call that passes  data directly to COHERENT.
It should not be intermixed with high-level calls, such as fread,
fwrite, or fopen.
























COHERENT Lexicon                                           Page 1


