1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4 <TITLE>Function Template copy</TITLE> 5 <LINK REL="stylesheet" HREF="../../../../boost.css"> 6 <LINK REL="stylesheet" HREF="../theme/iostreams.css"> 7</HEAD> 8<BODY> 9 10<!-- Begin Banner --> 11 12 <H1 CLASS="title">Function Template <CODE>copy</CODE></H1> 13 <HR CLASS="banner"> 14 15<!-- End Banner --> 16 17<DL class="page-index"> 18 <DT><A href="#description">Description</A></DT> 19 <DT><A href="#headers">Headers</A></DT> 20 <DT><A href="#synopsis">Synopsis</A></DT> 21</DL> 22 23<A NAME="description"></A> 24<H2>Description</H2> 25 26<P>The function template <CODE>copy</CODE> reads data from a given model of <A HREF="../concepts/source.html">Source</A> and writes it to a given model of <A HREF="../concepts/sink.html">Sink</A> until the end of stream is reached. It then closes both components, using the function template <A HREF="close.html"><CODE>close</CODE></A>, and returns the number of characters written.</P> 27 28<P>The size of the temporary buffer used may be supplied as an optional parameter.</P> 29 30<P>There are four overloads of <CODE>copy</CODE> to accommodate all combinations of <A HREF="../concepts/source.html">Sources</A> and <A HREF="../concepts/sink.html">Sinks</A>, which are passed by <CODE>const</CODE> reference, and streams and stream buffers, which are passed by non-<CODE>const</CODE> reference.</P> 31 32<A NAME="headers"></A> 33<H2>Headers</H2> 34 35<DL> 36 <DT><A CLASS="header" HREF="../../../../boost/iostreams/copy.hpp"><CODE><boost/iostreams/copy.hpp></CODE></A></DT> 37</DL> 38 39<A NAME="synopsis"></A> 40<H2>Synopsis</H2> 41 42<PRE CLASS="broken_ie"><SPAN CLASS="keyword">namespace</SPAN> boost { <SPAN CLASS="keyword">namespace</SPAN> iostreams { 43 44<SPAN CLASS="keyword">template</SPAN><<SPAN CLASS="keyword">typename</SPAN> Source, <SPAN CLASS="keyword">typename</SPAN> Sink> 45std::streamsize 46copy( [<SPAN CLASS="keyword">const</SPAN>] Source& src, [<SPAN CLASS="keyword">const</SPAN>] Sink& sink, 47 std::streamsize buffer_size = <SPAN CLASS="omitted">default value</SPAN> ); 48 49} } <SPAN CLASS="comment">// End namespace boost::io</SPAN></PRE> 50 51 52<!-- Begin Footer --> 53 54<HR> 55 56<P CLASS="copyright">© Copyright 2008 <a href="http://www.coderage.com/" target="_top">CodeRage, LLC</a><br/>© Copyright 2004-2007 <a href="https://www.boost.org/users/people/jonathan_turkanis.html" target="_top">Jonathan Turkanis</a></P> 57<P CLASS="copyright"> 58 Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <A HREF="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>) 59</P> 60 61<!-- End Footer --> 62 63</BODY>