1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Buffer-oriented synchronous random-access read device requirements</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="../reference.html" title="Reference"> 9<link rel="prev" href="SignalHandler.html" title="Signal handler requirements"> 10<link rel="next" href="SyncRandomAccessWriteDevice.html" title="Buffer-oriented synchronous random-access write device requirements"> 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="SignalHandler.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.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="SyncRandomAccessWriteDevice.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 24</div> 25<div class="section"> 26<div class="titlepage"><div><div><h3 class="title"> 27<a name="boost_asio.reference.SyncRandomAccessReadDevice"></a><a class="link" href="SyncRandomAccessReadDevice.html" title="Buffer-oriented synchronous random-access read device requirements">Buffer-oriented 28 synchronous random-access read device requirements</a> 29</h3></div></div></div> 30<p> 31 In the table below, <code class="computeroutput">a</code> denotes a synchronous random-access read 32 device object, <code class="computeroutput">o</code> denotes an offset of type <code class="computeroutput">boost::uint64_t</code>, 33 <code class="computeroutput">mb</code> denotes an object satisfying <a class="link" href="MutableBufferSequence.html" title="Mutable buffer sequence requirements">mutable 34 buffer sequence</a> requirements, and <code class="computeroutput">ec</code> denotes an object 35 of type <code class="computeroutput">error_code</code>. 36 </p> 37<div class="table"> 38<a name="boost_asio.reference.SyncRandomAccessReadDevice.t0"></a><p class="title"><b>Table 28. Buffer-oriented synchronous random-access read device requirements</b></p> 39<div class="table-contents"><table class="table" summary="Buffer-oriented synchronous random-access read device requirements"> 40<colgroup> 41<col> 42<col> 43<col> 44</colgroup> 45<thead><tr> 46<th> 47 <p> 48 operation 49 </p> 50 </th> 51<th> 52 <p> 53 type 54 </p> 55 </th> 56<th> 57 <p> 58 semantics, pre/post-conditions 59 </p> 60 </th> 61</tr></thead> 62<tbody> 63<tr> 64<td> 65 <p> 66 <code class="computeroutput">a.read_some_at(o, mb);</code> 67 </p> 68 </td> 69<td> 70 <p> 71 <code class="computeroutput">size_t</code> 72 </p> 73 </td> 74<td> 75 <p> 76 Equivalent to: 77</p> 78<pre class="programlisting">error_code ec; 79size_t s = a.read_some_at(o, mb, ec); 80if (ec) throw system_error(ec); 81return s; 82</pre> 83<p> 84 </p> 85 </td> 86</tr> 87<tr> 88<td> 89 <p> 90 <code class="computeroutput">a.read_some_at(o, mb, ec);</code> 91 </p> 92 </td> 93<td> 94 <p> 95 <code class="computeroutput">size_t</code> 96 </p> 97 </td> 98<td> 99 <p> 100 Reads one or more bytes of data from the device <code class="computeroutput">a</code> 101 at offset <code class="computeroutput">o</code>.<br> <br> The mutable buffer sequence 102 <code class="computeroutput">mb</code> specifies memory where the data should be placed. 103 The <code class="computeroutput">read_some_at</code> operation shall always fill a buffer 104 in the sequence completely before proceeding to the next.<br> 105 <br> If successful, returns the number of bytes read and sets 106 <code class="computeroutput">ec</code> such that <code class="computeroutput">!ec</code> is true. If an error 107 occurred, returns <code class="computeroutput">0</code> and sets <code class="computeroutput">ec</code> such 108 that <code class="computeroutput">!!ec</code> is true.<br> <br> If the total size 109 of all buffers in the sequence <code class="computeroutput">mb</code> is <code class="computeroutput">0</code>, 110 the function shall return <code class="computeroutput">0</code> immediately. 111 </p> 112 </td> 113</tr> 114</tbody> 115</table></div> 116</div> 117<br class="table-break"> 118</div> 119<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 120<td align="left"></td> 121<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M. 122 Kohlhoff<p> 123 Distributed under the Boost Software License, Version 1.0. (See accompanying 124 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>) 125 </p> 126</div></td> 127</tr></table> 128<hr> 129<div class="spirit-nav"> 130<a accesskey="p" href="SignalHandler.html"><img src="../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../reference.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="SyncRandomAccessWriteDevice.html"><img src="../../../../doc/src/images/next.png" alt="Next"></a> 131</div> 132</body> 133</html> 134