Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext
basic_random_access_file::open (2 of 4 overloads)

Inherited from basic_file.

Open the file using the specified path.

void open(
    const char * path,
    file_base::flags open_flags,
    boost::system::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.

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

PrevUpHomeNext