Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

basic_file

Provides file functionality.

template<
    typename Executor>
class basic_file :
  public file_base
Types

Name

Description

rebind_executor

Rebinds the file type to another executor.

executor_type

The type of the executor associated with the object.

flags

A bitmask type (C++ Std [lib.bitmask.types]).

native_handle_type

The native representation of a file.

seek_basis

Basis for seeking in a file.

Member Functions

Name

Description

assign

Assign an existing native file to the file.

basic_file [constructor]

Construct a basic_file without opening it.

Construct and open a basic_file.

Construct a basic_file on an existing native file handle.

Construct a basic_file on an existing native file.

Move-construct a basic_file from another.

Move-construct a basic_file from a file of another executor type.

cancel

Cancel all asynchronous operations associated with the file.

close

Close the file.

get_executor

Get the executor associated with the object.

is_open

Determine whether the file is open.

native_handle

Get the native file representation.

open

Open the file using the specified path.

operator=

Move-assign a basic_file from another.

Move-assign a basic_file from a file of another executor type.

release

Release ownership of the underlying native file.

resize

Alter the size of the file.

size

Get the size of the file.

sync_all

Synchronise the file to disk.

sync_data

Synchronise the file data to disk.

Protected Member Functions

Name

Description

~basic_file [destructor]

Protected destructor to prevent deletion through this type.

Data Members

Name

Description

append [static]

Open the file in append mode.

create [static]

Create the file if it does not exist.

exclusive [static]

Ensure a new file is created. Must be combined with create.

read_only [static]

Open the file for reading.

read_write [static]

Open the file for reading and writing.

sync_all_on_write [static]

Open the file so that write operations automatically synchronise the file data and metadata to disk.

truncate [static]

Open the file with any existing contents truncated.

write_only [static]

Open the file for writing.

The basic_file class template provides functionality that is common to both stream-oriented and random-access files.

Thread Safety

Distinct objects: Safe.

Shared objects: Unsafe.

Requirements

Header: boost/asio/basic_file.hpp

Convenience header: boost/asio.hpp


PrevUpHomeNext