bitflag enum io.FileOpenFlags

Overview

This enumeration specifies available options for opening io.File, io.FileStream or io.MappedFile. More…

bitflag enum FileOpenFlags {
    ReadOnly,
    WriteOnly,
    OpenExisting,
    Exclusive,
    ShareWrite,
    DeleteOnClose,
    Unlink,
    Clear,
    Asynchronous,
    WriteAttributes,
};

Detailed Documentation

This enumeration specifies available options for opening io.File, io.FileStream or io.MappedFile.

When opening files or devices with open method, the second argument flags can be used to adjust options.

See also:

io.File, io.FileStream, io.MappedFile

Enum Values

ReadOnly

File or device should be opened in read-only mode. When file is opened in read-only mode, trying to perform modifying operations such as calling write method or changing the file size via m_size property will fail with access violation system error.

WriteOnly

File or device should be opened in write-only mode. When file is opened in read-only mode, calling read method fail with the access violation system error.

Note that certain files and devices could only be opened in write-only mode(e.g., client mailslot files on Windows)

OpenExisting

Do not try to create a file if it does not exist.

If file specified by name argument to open method does not exist, open method should fail rather than try to create a new empty file with such a name(which would be the default option).

Exclusive

Open a file or device in exclusive mode. If another thread or process simultaneously tries to open the same file – no matter if it specifies read-write, read-only or write-only modes – it will fail with the access violation system error.

ShareWrite

Allow multiple threads or processes to open the same file for writing. This overrides the default behaviour – normally, only one write-access handle to the file is allowed at the same time(subsequent attempts to open the file for writing will fail with the access violation system error)

DeleteOnClose

File should be deleted as soon as the last handle to it is being closed.

Windows only. Maps to FILE_FLAG_DELETE_ON_CLOSE.

File should be unlink-ed immediately afer creation.

POSIX only.

Clear

File should be cleared immediately afer creation.

Asynchronous

File is opened in asynchronous mode.

Maps to FILE_FLAG_OVERLAPPED on Windows, O_NONBLOCK on POSIX.

WriteAttributes

Windows only. Requests special FILE_WRITE_ATTRIBUTES access.