##### basic_file::open (4 of 4 overloads)

Open the file using the specified path.

    void open(
        const std::string & path,
        file_base::flags open_flags,
        asio::error_code & ec);

This function opens the file so that it will use the specified path.

###### Parameters

path

  The path name identifying the file to be opened.

open_flags

  A set of flags that determine how the file should be opened.

ec

  Set to indicate what error occurred, if any.

Exactly one of the following `file_base::flags` values must be specified:

- flags::read_only
- flags::write_only
- flags::read_write

The following flags may be bitwise or-ed in addition:

- flags::append
- flags::create
- flags::exclusive
- flags::truncate
- flags::sync_all_on_write

###### Example

    asio::stream_file file(my_context);
    asio::error_code ec;
    file.open("/path/to/my/file", asio::stream_file::read_only, ec);
    if (ec)
    {
      // An error occurred.
    }