01.01.2013 Views

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

OPEN ( 2 ) OPEN ( 2 )<br />

NAME<br />

open - open for reading or writing<br />

SYNOPSIS<br />

#include <br />

int open (path, oflag [ , mode ] )<br />

char *path;<br />

int oflag, mode;<br />

DESCRIPTION<br />

Path points to a path name naming a file. Open opens a file<br />

descriptor for the named file and sets the file status flags according<br />

to the value of oflag . Oflag values are constructed by or-ing flags<br />

from the following list (only one of the first three flags below may<br />

be used):<br />

O_RDONLY Open for reading only.<br />

O_WRONLY Open for writing only.<br />

O_RDWR Open for reading and writing.<br />

O_NDELA Y This flag may affect subsequent reads and writes.<br />

See read(2) and write(2).<br />

When opening a FIFO with O_RDONL Y or<br />

O_WRONLY set:<br />

If O_NDELAY is set:<br />

An open for reading-only will return<br />

without delay. An open for writing-only<br />

will return an error if no process currently<br />

has the file open for reading.<br />

If O_NDELAY is clear:<br />

An open for reading-only will block until<br />

a process opens the file for writing. An<br />

open for writing-only will block until a<br />

process opens the file for reading.<br />

When opening a file associated with a communication<br />

line:<br />

If O_NDELAY is set:<br />

The open will return without waiting for<br />

carrier.<br />

If O_NDELAY is clear:<br />

The open will block until carrier is<br />

present.<br />

O_APPEND If set, the file pointer will be set to the end of the<br />

file prior to each write.<br />

O_CREAT If the file exists, this flag has no effect. Otherwise,<br />

the file's owner ID is set to the process's effective<br />

- 1 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!