FileOpenMode - SeqAn API Documentation

# Enum FileOpenMode
Flags to select the open mode of a File or external string.

Defined in | <seqan/file.h>
Signature | ``

## Enum Values

`OPEN_RDONLY` | Open in read-only mode.
`OPEN_WRONLY` | Open in write-only mode.
`OPEN_RDWR` | Open for reading and writing.
`OPEN_CREATE` | Create the file if it does not yet exists.
`OPEN_APPEND` | Keep the existing data. If this flag is not given then the file is cleared in write mode.
`OPEN_QUIET` | Don't print any warning message if the file could not be opened.
`OPEN_MASK` | (Internal) Bitmask to extract the read/write open mode.
`OPEN_ASYNC` | (Internal) Open the file for asynchronous file access. For asynchronous file access, use the AsyncFile.
`OPEN_TEMPORARY` | (Internal) Open automatically delete the file after close. Use the `openTemp` methods to open temporary files.

## Detailed Description

These flags can be combined via the `|` operator (bitwise OR). The defualt open mode is `OPEN_RDWR | OPEN_CREATE | OPEN_APPEND`.

If you omit the `OPEN_APPEND` flag in write mode, the file will be truncated to size 0 when opened.

### Examples

Code example to test for read-only mode:

    if (openMode & OPEN_MASK == OPEN_READ)
        // do something if opened in read-only mode

#### Dox Sources

    /*!
     * @enum FileOpenMode
     *
     * @headerfile <seqan/file.h>
     *
     * @brief Flags to select the open mode of a @link File @endlink or external
     *        string.
     *
     * These flags can be combined via the <tt>|</tt> operator (bitwise OR). The
     * defualt open mode is <tt>OPEN_RDWR | OPEN_CREATE | OPEN_APPEND</tt>.
     *
     * If you omit the <tt>OPEN_APPEND</tt> flag in write mode, the file will be
     * truncated to size 0 when opened.
     *
     * @section Examples
     *
     * Code example to test for read-only mode:
     *
     * @code{.cpp}
     * if (openMode & OPEN_MASK == OPEN_READ)
     *     // do something if opened in read-only mode
     * @endcode
     *
     *
     * @val FileOpenMode OPEN_RDONLY;
     *
     * @brief Open in read-only mode.
     *
     * @val FileOpenMode OPEN_WRONLY;
     *
     * @brief Open in write-only mode.
     *
     * @val FileOpenMode OPEN_RDWR;
     *
     * @brief Open for reading and writing.
     *
     * @val FileOpenMode OPEN_CREATE;
     *
     * @brief Create the file if it does not yet exists.
     *
     * @val FileOpenMode OPEN_APPEND;
     *
     * @brief Keep the existing data. If this flag is not given then the file is
     *        cleared in write mode.
     *
     * @val FileOpenMode OPEN_QUIET;
     *
     * @brief Don't print any warning message if the file could not be opened.
     *
     * @val FileOpenMode OPEN_MASK;
     *
     * @brief (Internal) Bitmask to extract the read/write open mode.
     *
     * @val FileOpenMode OPEN_ASYNC;
     *
     * @brief (Internal) Open the file for asynchronous file access. For
     *        asynchronous file access, use the @link AsyncFile @endlink.
     *
     * @val FileOpenMode OPEN_TEMPORARY;
     *
     * @brief (Internal) Open automatically delete the file after close. Use the
     *        <tt>openTemp</tt> methods to open temporary files.
     */