| 1 | .TH OPEN 2 |
| 2 | .SH NAME |
| 3 | open \- open for reading or writing |
| 4 | .SH SYNOPSIS |
| 5 | .B open(name, mode) |
| 6 | .br |
| 7 | .B char *name; |
| 8 | .SH DESCRIPTION |
| 9 | .I Open |
| 10 | opens the file |
| 11 | .I name |
| 12 | for reading |
| 13 | (if |
| 14 | .I mode |
| 15 | is 0), |
| 16 | writing (if |
| 17 | .I mode |
| 18 | is 1) or for both reading and writing |
| 19 | (if |
| 20 | .I mode |
| 21 | is 2). |
| 22 | .I Name |
| 23 | is the address of a string of ASCII characters representing |
| 24 | a path name, terminated by a null character. |
| 25 | .PP |
| 26 | The file is positioned at the beginning (byte 0). |
| 27 | The returned file descriptor must be used for subsequent calls |
| 28 | for other input-output functions on the file. |
| 29 | .SH "SEE ALSO" |
| 30 | creat(2), read(2), write(2), dup(2), close(2) |
| 31 | .SH DIAGNOSTICS |
| 32 | The value \-1 is returned |
| 33 | if the file does not exist, |
| 34 | if one of the necessary directories |
| 35 | does not exist or is unreadable, if the file is not |
| 36 | readable (resp. writable), or if too many files are open. |
| 37 | .SH "ASSEMBLER (PDP-11)" |
| 38 | (open = 5.) |
| 39 | .br |
| 40 | .B sys open; name; mode |
| 41 | .br |
| 42 | (file descriptor in r0) |