Imported Upstream version 1.64.0
[platform/upstream/boost.git] / doc / html / boost_asio / overview / windows / random_access_handle.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Random-Access HANDLEs</title>
5 <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../../boost_asio.html" title="Boost.Asio">
8 <link rel="up" href="../windows.html" title="Windows-Specific Functionality">
9 <link rel="prev" href="stream_handle.html" title="Stream-Oriented HANDLEs">
10 <link rel="next" href="object_handle.html" title="Object HANDLEs">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../more/index.htm">More</a></td>
20 </tr></table>
21 <hr>
22 <div class="spirit-nav">
23 <a accesskey="p" href="stream_handle.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../windows.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="object_handle.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
24 </div>
25 <div class="section">
26 <div class="titlepage"><div><div><h4 class="title">
27 <a name="boost_asio.overview.windows.random_access_handle"></a><a class="link" href="random_access_handle.html" title="Random-Access HANDLEs">Random-Access
28         HANDLEs</a>
29 </h4></div></div></div>
30 <p>
31           Boost.Asio provides Windows-specific classes that permit asynchronous read
32           and write operations to be performed on HANDLEs that refer to regular files.
33         </p>
34 <p>
35           For example, to perform asynchronous operations on a file the following
36           object may be created:
37         </p>
38 <pre class="programlisting"><span class="identifier">HANDLE</span> <span class="identifier">handle</span> <span class="special">=</span> <span class="special">::</span><span class="identifier">CreateFile</span><span class="special">(...);</span>
39 <span class="identifier">windows</span><span class="special">::</span><span class="identifier">random_access_handle</span> <span class="identifier">file</span><span class="special">(</span><span class="identifier">my_io_service</span><span class="special">,</span> <span class="identifier">handle</span><span class="special">);</span>
40 </pre>
41 <p>
42           Data may be read from or written to the handle using one of the <code class="computeroutput"><span class="identifier">read_some_at</span><span class="special">()</span></code>,
43           <code class="computeroutput"><span class="identifier">async_read_some_at</span><span class="special">()</span></code>,
44           <code class="computeroutput"><span class="identifier">write_some_at</span><span class="special">()</span></code>
45           or <code class="computeroutput"><span class="identifier">async_write_some_at</span><span class="special">()</span></code> member functions. However, like the equivalent
46           functions (<code class="computeroutput"><span class="identifier">read_some</span><span class="special">()</span></code>,
47           etc.) on streams, these functions are only required to transfer one or
48           more bytes in a single operation. Therefore free functions called <a class="link" href="../../reference/read_at.html" title="read_at">read_at()</a>, <a class="link" href="../../reference/async_read_at.html" title="async_read_at">async_read_at()</a>,
49           <a class="link" href="../../reference/write_at.html" title="write_at">write_at()</a> and <a class="link" href="../../reference/async_write_at.html" title="async_write_at">async_write_at()</a> have
50           been created to repeatedly call the corresponding <code class="literal"><span class="bold"><strong>*</strong></span>_some_at()</code>
51           function until all data has been transferred.
52         </p>
53 <h6>
54 <a name="boost_asio.overview.windows.random_access_handle.h0"></a>
55           <span class="phrase"><a name="boost_asio.overview.windows.random_access_handle.see_also"></a></span><a class="link" href="random_access_handle.html#boost_asio.overview.windows.random_access_handle.see_also">See
56           Also</a>
57         </h6>
58 <p>
59           <a class="link" href="../../reference/windows__random_access_handle.html" title="windows::random_access_handle">windows::random_access_handle</a>,
60           <a class="link" href="../../reference/windows__basic_random_access_handle.html" title="windows::basic_random_access_handle">windows::basic_random_access_handle</a>,
61           <a class="link" href="../../reference/windows__random_access_handle_service.html" title="windows::random_access_handle_service">windows::random_access_handle_service</a>.
62         </p>
63 <h6>
64 <a name="boost_asio.overview.windows.random_access_handle.h1"></a>
65           <span class="phrase"><a name="boost_asio.overview.windows.random_access_handle.notes"></a></span><a class="link" href="random_access_handle.html#boost_asio.overview.windows.random_access_handle.notes">Notes</a>
66         </h6>
67 <p>
68           Windows random-access <code class="computeroutput"><span class="identifier">HANDLE</span></code>s
69           are only available at compile time when targeting Windows and only when
70           the I/O completion port backend is used (which is the default). A program
71           may test for the macro <code class="computeroutput"><span class="identifier">BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE</span></code>
72           to determine whether they are supported.
73         </p>
74 </div>
75 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
76 <td align="left"></td>
77 <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2017 Christopher M. Kohlhoff<p>
78         Distributed under the Boost Software License, Version 1.0. (See accompanying
79         file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
80       </p>
81 </div></td>
82 </tr></table>
83 <hr>
84 <div class="spirit-nav">
85 <a accesskey="p" href="stream_handle.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../windows.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../boost_asio.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="object_handle.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
86 </div>
87 </body>
88 </html>