Boost logo

Boost :

From: Takeshi Mouri (takeshi.mouri.net_at_[hidden])
Date: 2006-08-03 11:13:31


Hello,

I noticed that there is a problem in treating the parameter "which"
on iostreams::close().
So, the following code doesn't output anything to standard output.

#include <boost/iostreams/categories.hpp>
#include <boost/iostreams/close.hpp>
#include <iostream>

namespace io = boost::iostreams;

class test_sink
{
public:
    typedef char char_type;

    struct category : io::output, io::device_tag, io::closable_tag {};

    std::streamsize write(const char*, std::streamsize n)
    {
        return n;
    }

    void close()
    {
        std::cout << "called test_sink::close()" << std::endl;
    }
};

int main()
{
    test_sink sink;
    // doesn't call test_sink::close()
    io::close(sink, BOOST_IOS::in|BOOST_IOS::out);
}

OTH, some device adapters in Boost.Iostreams perform such function call
for closing the external device.
Such the adapters never close the external device.

The attachment is a patch for this problem.

Regards,
Takeshi Mouri




Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk