V7/usr/man/man2/open.2
.TH OPEN 2
.SH NAME
open \- open for reading or writing
.SH SYNOPSIS
.B open(name, mode)
.br
.B char *name;
.SH DESCRIPTION
.I Open
opens the file
.I name
for reading
(if
.I mode
is 0),
writing (if
.I mode
is 1) or for both reading and writing
(if
.I mode
is 2).
.I Name
is the address of a string of ASCII characters representing
a path name, terminated by a null character.
.PP
The file is positioned at the beginning (byte 0).
The returned file descriptor must be used for subsequent calls
for other input-output functions on the file.
.SH "SEE ALSO"
creat(2), read(2), write(2), dup(2), close(2)
.SH DIAGNOSTICS
The value \-1 is returned
if the file does not exist,
if one of the necessary directories
does not exist or is unreadable, if the file is not
readable (resp. writable), or if too many files are open.
.SH ASSEMBLER
(open = 5.)
.br
.B sys open; name; mode
.br
(file descriptor in r0)