使用指定的路径打开文件。
void open( const std::string & path, file_base::flags open_flags, boost::system::error_code & ec);
此函数打开文件,以便它将使用指定的路径。
标识要打开文件的路径名。
一组标志,用于确定文件应如何打开。
设置为指示发生了什么错误(如果有)。
必须指定以下 file_base::flags
值之一
以下标志可以按位或运算进行添加
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. }