Boost logo

Boost Users :

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


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