Boost logo

Boost Users :

From: Gavin Lambert (boost_at_[hidden])
Date: 2020-08-31 04:08:45


On 31/08/2020 14:59, lampahome wrote:
> As title, I read boost.asio documents and generally said io about
> http/network.
>
> I don't see any info. of io of files. Does boost.asio support read/write
> io of files asynchronously?

I haven't tried any of these methods, but it does provide the
posix::stream_descriptor and windows::{stream,random_access}_handle
classes which should be able to operate on native files. (You'll have
to use a native OS-level function to open the handle/descriptor for the
file and pass ownership to the ASIO object; they lack means to do the
opening itself.)

https://www.boost.org/doc/libs/1_74_0/doc/html/boost_asio/overview/posix/stream_descriptor.html

https://www.boost.org/doc/libs/1_74_0/doc/html/boost_asio/overview/windows/stream_handle.html
https://www.boost.org/doc/libs/1_74_0/doc/html/boost_asio/overview/windows/random_access_handle.html

Alternatively, there's another library (that I also haven't used)
dedicated to async file I/O. It originally started life based on ASIO
but I think it's since diverged into something else. And called
something different from the last time I saw it as well.

Its current home appears to be: https://ned14.github.io/llfio/

(The impression I have, which may be mistaken, is that it is possibly
overkill for general application use, unless you're trying to implement
some kind of custom database engine rather than just using an
off-the-shelf DB library.)


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net