.TH OPEN 2 .CT 2 file_io .SH NAME open \(mi open for reading or writing .SH SYNOPSIS .nf .B int open(name, rwmode) .B char *name; .fi .SH DESCRIPTION .I Open opens the file .I name for reading (if .I rwmode is 0), writing (if .I rwmode is 1) or for both reading and writing (if .I rwmode is 2) and returns an associated file descriptor. .I Name is a null-terminated string representing a path name. .PP The file pointer is set to 0. .PP It is not possible to open for writing a file with set-userid or set-groupid permission; see .IR stat (2). .SH "SEE ALSO" .IR close (2), .IR creat (2), .IR dup (2), .IR read (2), .IR write (2) .SH DIAGNOSTICS .BR EACCES , .BR EBUSY , .BR ECONC , .BR EFAULT , .BR EINTR , .BR EIO , .BR EISDIR , .BR ELAB , .BR ELOOP , .BR EMFILE , .BR ENFILE , .BR ENOENT , .BR ENOTDIR , .BR EROFS , .BR ETXTBSY .SH BUGS It should be possible to open files for writing with exclusive use, and to call .I open without the necessity of waiting for carrier on communication lines.