Boost logo

Boost Users :

Subject: Re: [Boost-users] [asio] Passing streams into async_write()?
From: Robert Dailey (rcdailey_at_[hidden])
Date: 2009-08-25 18:59:20


Seems like it has issues with the stream being passed into async_write as
const.

---------
Robert Dailey

On Tue, Aug 25, 2009 at 5:41 PM, Robert Dailey <rcdailey_at_[hidden]> wrote:

> Hello,
> I have a std::istream that I pass into a function that calls async_write.
> Currently here is what I have:
>
> void SerialClient::DoWrite( std::istream const& data )
> {
> boost::asio::async_write(
> m_port,
> boost::asio::buffer( data.rdbuf() ),
> boost::bind( &SerialClient::WriteCompleted, this,
> boost::asio::placeholders::error )
> );
> }
>
> Obviously this does not compile. There is no overload of buffer() that
> takes a streambuf. How can I get asio to write out my stream?
>
>
> ---------
> Robert Dailey
>



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