| Home | Libraries | People | FAQ | More

#### file_mode

File open modes.

##### Synopsis

Defined in header `<boost/beast/core/file_base.hpp>`

    enum file_mode

##### Values

Name | Description
--- | ---
`read` | Random read-only access to an existing file.
`scan` | Sequential read-only access to an existing file.
`write` | Random reading and writing to a new or truncated file. This mode permits random-access reading and writing for the specified file. If the file does not exist prior to the function call, it is created with an initial size of zero bytes. Otherwise if the file already exists, the size is truncated to zero bytes.
`write_new` | Random reading and writing to a new file only. This mode permits random-access reading and writing for the specified file. The file will be created with an initial size of zero bytes. If the file already exists prior to the function call, an error is returned and no file is opened.
`write_existing` | Random write-only access to existing file. If the file does not exist, an error is generated.
`append` | Appending to a new or truncated file. The current file position shall be set to the end of the file prior to each write. @li If the file does not exist, it is created. @li If the file exists, it is truncated to zero size upon opening.
`append_existing` | Appending to an existing file. The current file position shall be set to the end of the file prior to each write. If the file does not exist, an error is generated.

##### Description

These modes are used when opening files using instances of the File concept.

##### See Also

`file_stdio`

Convenience header `<boost/beast/core.hpp>`