Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

Random-Access HANDLEs

Boost.Asio provides Windows-specific classes that permit asynchronous read and write operations to be performed on HANDLEs that refer to regular files.

For example, to perform asynchronous operations on a file the following object may be created:

HANDLE handle = ::CreateFile(...);
windows::random_access_handle file(my_io_context, handle);

Data may be read from or written to the handle using one of the read_some_at(), async_read_some_at(), write_some_at() or async_write_some_at() member functions. However, like the equivalent functions (read_some(), etc.) on streams, these functions are only required to transfer one or more bytes in a single operation. Therefore free functions called read_at(), async_read_at(), write_at() and async_write_at() have been created to repeatedly call the corresponding *_some_at() function until all data has been transferred.

See Also

windows::random_access_handle.

Notes

Windows random-access HANDLEs are only available at compile time when targeting Windows and only when the I/O completion port backend is used (which is the default). A program may test for the macro BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE to determine whether they are supported.


PrevUpHomeNext