BSD 3 development
[unix-history] / usr / man / man2 / open.2
CommitLineData
e6817382
BJ
1.TH OPEN 2
2.SH NAME
3open \- 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
10opens the file
11.I name
12for reading
13(if
14.I mode
15is 0),
16writing (if
17.I mode
18is 1) or for both reading and writing
19(if
20.I mode
21is 2).
22.I Name
23is the address of a string of ASCII characters representing
24a path name, terminated by a null character.
25.PP
26The file is positioned at the beginning (byte 0).
27The returned file descriptor must be used for subsequent calls
28for other input-output functions on the file.
29.SH "SEE ALSO"
30creat(2), read(2), write(2), dup(2), close(2)
31.SH DIAGNOSTICS
32The value \-1 is returned
33if the file does not exist,
34if one of the necessary directories
35does not exist or is unreadable, if the file is not
36readable (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)