mirror of
https://github.com/boostorg/asio.git
synced 2026-01-24 17:42:08 +00:00
This change adds support for stream-oriented and random-access files.
For example, to write to a newly created stream-oriented file:
asio::stream_file file(
my_io_context, "/path/to/file",
asio::stream_file::write_only
| asio::stream_file::create
| asio::stream_file::truncate);
file.async_write_some(my_buffer,
[](error_code e, size_t n)
{
// ...
});
or to read from a random-access file:
asio::random_access_file file(
my_io_context, "/path/to/file",
asio::random_access_file::read_only);
file.async_read_some_at(1234, my_buffer,
[](error_code e, size_t n)
{
// ...
});
This feature currently supports I/O completion ports on Windows, and
io_uring on Linux (define BOOST_ASIO_HAS_IO_URING to enable).
27 lines
799 B
Plaintext
27 lines
799 B
Plaintext
#
|
|
# Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com)
|
|
#
|
|
# Distributed under the Boost Software License, Version 1.0. (See accompanying
|
|
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
|
#
|
|
|
|
lib uring ; # LINUX
|
|
lib ws2_32 ; # NT
|
|
lib mswsock ; # NT
|
|
|
|
project
|
|
: requirements
|
|
<library>/boost/system//boost_system
|
|
<library>/boost/thread//boost_thread
|
|
<define>BOOST_ALL_NO_LIB=1
|
|
<threading>multi
|
|
<target-os>linux:<define>BOOST_ASIO_HAS_IO_URING=1
|
|
<target-os>linux:<library>uring
|
|
<target-os>windows:<define>_WIN32_WINNT=0x0600
|
|
<target-os>windows,<toolset>gcc:<library>ws2_32
|
|
<target-os>windows,<toolset>gcc:<library>mswsock
|
|
;
|
|
|
|
exe async_file_copy : async_file_copy.cpp ;
|
|
exe blocking_file_copy : blocking_file_copy.cpp ;
|