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.
The file constants are as follows:
Repositions the file pointer to the end of the file before every write operation.
Creates and opens a new file for writing; this has no effect if the file specified by filename exists.
Returns an error value if the file specified by filename exists. Only applies when used with _O_CREAT.
Opens file for reading only; if this flag is given, neither _O_RDWR nor _O_WRONLY can be given.
Opens file for both reading and writing; if this flag is given, neither _O_RDONLY nor _O_WRONLY can be given.
Opens and truncates an existing file to zero length; the file must have write permission. The contents of the file are destroyed. If this flag is given, you cannot specify _O_RDONLY.
Opens file for writing only; if this flag is given, neither _O_RDONLY nor _O_RDWR can be given.