FileFlags

File flags that determine how a file stream is created and used.

Since all methods in this struct are pure, the high-level configuration flags given here are converted to the platform-specific file flags at compile time.

Constructors

this
this(Mode mode, Access access, Share share)

Constructs the FileFlag with the given mode, access, and share attributes. These high-level flags are converted to the equivalent platform-specific flags that are needed when opening the file.

this
this(Mode mode, Access access, Share share)
Undocumented in source.
this
this(string mode)
opAssign
void opAssign(string mode)

Constructs the file flags from a mode string.

Alias This

flags

Members

Functions

Static functions

parse
FileFlags parse(string mode)

Parses an fopen-style mode string such as "r+". All possible mode strings include:

Static variables

readExisting
FileFlags readExisting;

An existing file is opened with read access. This is likely the most commonly used set of flags.

readWriteAlways
FileFlags readWriteAlways;

A new file is either opened or created with read/write access.

readWriteEmpty
FileFlags readWriteEmpty;

A new file is either opened or created, truncated if necessary, with read/write access. This ensures that an empty file is opened.

readWriteExisting
FileFlags readWriteExisting;

An existing file is opened with read/write access.

readWriteNew
FileFlags readWriteNew;

A new file is created with read/write access. Fails if the file already exists.

writeAlways
FileFlags writeAlways;

A new file is either opened or created with write access.

writeEmpty
FileFlags writeEmpty;

A new file is either opened or created, truncated if necessary, with write access. This ensures that an empty file is opened.

writeExisting
FileFlags writeExisting;

An existing file is opened with write access.

writeNew
FileFlags writeNew;

A new file is created with write access. Fails if the file already exists.

Variables

access
DWORD access;
Undocumented in source.
flags
int flags;
mode
DWORD mode;
share
DWORD share;
Undocumented in source.

Examples

// Creates the file "foobar", truncates it, and opens it in write-only mode
auto f = File("foobar", FileFlags.writeEmpty);

See Also

io.file.stream

Meta