使用指定路径打开文件。
void open( const char * 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. }