Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
File Constants
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
Constant: O_APPEND, O_CREAT, O_EXCL, O_RDONLY, O_RDWR, O_TRUNC,
O_WRONLY
Include: <fcntl.h>
Context: open, sopen, _dos_open
Synopsis: The integer expression formed from one or more of these
constants determines the type of reading or writing
operations permitted. It is formed by combining one or
more constants with a translation-mode constant (see
O_BINARY or O_TEXT).
The file constants are described below:
Constant Meaning
O_APPEND Repositions the file pointer to the end of the file
before every write operation.
O_CREAT Creates and opens a new file for writing; this has no
effect if the file specified by the path name exists.
O_EXCL Returns an error value if the file specified by the
path name exists. Only applies when used with
O_CREAT.
O_RDONLY Opens file for reading only; if this flag is given,
neither O_RDWR nor O_WRONLY can be given.
O_RDWR Opens file for both reading and writing; if this flag
is given, neither O_RDONLY nor O_WRONLY can be given.
O_TRUNC Opens and truncates an existing file to zero length;
the file must have write permission. The contents of
the file are destroyed.
O_WRONLY Opens file for writing only; if this flag is given,
neither O_RDONLY nor O_RDWR can be given.