1READ(2)                       System Calls Manual                      READ(2)
2
3
4

NAME

6       read - read from file
7

SYNOPSIS

9       read(fildes, buffer, nbytes)
10       char *buffer;
11

DESCRIPTION

13       A  file  descriptor  is  a word returned from a successful open, creat,
14       dup, or pipe call.  Buffer is the location of nbytes  contiguous  bytes
15       into  which  the  input  will be placed.  It is not guaranteed that all
16       nbytes bytes will be read; for example if the file refers  to  a  type‐
17       writer  at  most one line will be returned.  In any event the number of
18       characters read is returned.
19
20       If the returned value is 0, then end-of-file has been reached.
21

SEE ALSO

23       open(2), creat(2), dup(2), pipe(2)
24

DIAGNOSTICS

26       As mentioned, 0 is returned when the end of the file has been  reached.
27       If  the  read  was otherwise unsuccessful the return value is -1.  Many
28       conditions can generate an  error:  physical  I/O  errors,  bad  buffer
29       address,  preposterous  nbytes,  file  descriptor  not that of an input
30       file.
31

ASSEMBLER

33       (read = 3.)
34       (file descriptor in r0)
35       sys read; buffer; nbytes
36       (byte count in r0)
37
38
39
40                                                                       READ(2)
Impressum