• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>read (10 of 16 overloads)</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="../read.html" title="read">
9<link rel="prev" href="overload9.html" title="read (9 of 16 overloads)">
10<link rel="next" href="overload11.html" title="read (11 of 16 overloads)">
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="overload9.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../read.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="overload11.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.reference.read.overload10"></a><a class="link" href="overload10.html" title="read (10 of 16 overloads)">read (10 of 16
28        overloads)</a>
29</h4></div></div></div>
30<p>
31          Attempt to read a certain amount of data from a stream before returning.
32        </p>
33<pre class="programlisting">template&lt;
34    typename <a class="link" href="../SyncReadStream.html" title="Buffer-oriented synchronous read stream requirements">SyncReadStream</a>,
35    typename Allocator&gt;
36std::size_t read(
37    SyncReadStream &amp; s,
38    basic_streambuf&lt; Allocator &gt; &amp; b,
39    boost::system::error_code &amp; ec);
40</pre>
41<p>
42          This function is used to read a certain number of bytes of data from a
43          stream. The call will block until one of the following conditions is true:
44        </p>
45<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
46<li class="listitem">
47              The supplied buffer is full (that is, it has reached maximum size).
48            </li>
49<li class="listitem">
50              An error occurred.
51            </li>
52</ul></div>
53<p>
54          This operation is implemented in terms of zero or more calls to the stream's
55          read_some function.
56        </p>
57<h6>
58<a name="boost_asio.reference.read.overload10.h0"></a>
59          <span class="phrase"><a name="boost_asio.reference.read.overload10.parameters"></a></span><a class="link" href="overload10.html#boost_asio.reference.read.overload10.parameters">Parameters</a>
60        </h6>
61<div class="variablelist">
62<p class="title"><b></b></p>
63<dl class="variablelist">
64<dt><span class="term">s</span></dt>
65<dd><p>
66                The stream from which the data is to be read. The type must support
67                the SyncReadStream concept.
68              </p></dd>
69<dt><span class="term">b</span></dt>
70<dd><p>
71                The <a class="link" href="../basic_streambuf.html" title="basic_streambuf"><code class="computeroutput">basic_streambuf</code></a>
72                object into which the data will be read.
73              </p></dd>
74<dt><span class="term">ec</span></dt>
75<dd><p>
76                Set to indicate what error occurred, if any.
77              </p></dd>
78</dl>
79</div>
80<h6>
81<a name="boost_asio.reference.read.overload10.h1"></a>
82          <span class="phrase"><a name="boost_asio.reference.read.overload10.return_value"></a></span><a class="link" href="overload10.html#boost_asio.reference.read.overload10.return_value">Return
83          Value</a>
84        </h6>
85<p>
86          The number of bytes transferred.
87        </p>
88<h6>
89<a name="boost_asio.reference.read.overload10.h2"></a>
90          <span class="phrase"><a name="boost_asio.reference.read.overload10.remarks"></a></span><a class="link" href="overload10.html#boost_asio.reference.read.overload10.remarks">Remarks</a>
91        </h6>
92<p>
93          This overload is equivalent to calling:
94        </p>
95<pre class="programlisting">boost::asio::read(
96    s, b,
97    boost::asio::transfer_all(), ec);
98</pre>
99</div>
100<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
101<td align="left"></td>
102<td align="right"><div class="copyright-footer">Copyright © 2003-2020 Christopher M.
103      Kohlhoff<p>
104        Distributed under the Boost Software License, Version 1.0. (See accompanying
105        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>)
106      </p>
107</div></td>
108</tr></table>
109<hr>
110<div class="spirit-nav">
111<a accesskey="p" href="overload9.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../read.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="overload11.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
112</div>
113</body>
114</html>
115