Openflags
Openflags are a set of bitwise options passed to a file opening system call to control how a file is opened. They are most commonly associated with the POSIX open function, where the flags modify access mode, creation behavior, and I/O characteristics of the resulting file descriptor. Openflags are typically combined using bitwise OR to produce a single integer argument.
The flags fall into several categories. The access mode flags determine how the file will be accessed:
A typical example is open("file.txt", O_WRONLY | O_CREAT | O_TRUNC, 0644), which opens for writing, creates the file
Cross-platform notes: while POSIX defines a core set of flags, some environments (such as Windows) provide different
Security considerations include using O_EXCL with O_CREAT to avoid TOCTOU races, and using O_CLOEXEC to prevent