O_xxxx #defines

De RAD Studio
Aller à : navigation, rechercher

Remonter à Fcntl.h - Index


Header File

fcntl.h

Description

These #defines are bit definitions for a file-access argument.

These RTL file-open functions use some (not all) of these definitions:

  • fdopen
  • fopen
  • freopen
  • _fsopen
  • open
  • _rtl_open
  • sopen

sopen also uses file-sharing symbolic constants in the file-access argument.



Constant

Description

Read/Write flag

O_RDONLY

Open for reading only

O_WRONLY

Open for writing only

O_RDWR

Open for reading and writing

Other access flags

O_NDELAY

Not used; for UNIX compatibility.

O_APPEND

Append to end of file

If set, the file pointer is set to the end of the file prior to each write.

O_CREAT

Create and open file

If the file already exists, has no effect.

If the file does not exist, the file is created.

O_EXCL

Exclusive open: Used only with O_CREAT.

If the file already exists, an error is returned.

O_TRUNC

Open with truncation

If the file already exists, its length is truncated to 0. The file attributes remain unchanged.

Binary-mode/Text-mode flags

O_BINARY

No translation: Explicitly opens the file in binary mode

O_TEXT

CR-LF translation: Explicitly opens the file in text mode

Additional values available using _rtl_open

O_NOINHERIT

Child processes inherit file

O_DENYALL

Error if opened for read/write

O_DENYWRITE

Error if opened for write

O_DENYREAD

Error if opened for read

O_DENYNONE

Allow concurrent access



Note: Only one of the O_DENYxxx options can be included in a single open. These file-sharing attributes are in addition to any locking performed on the files.



Do not modify

O_CHANGED

Special DOS read-only bit

O_DEVICE

Special DOS read-only bit