[iostreams] boost::ostreams::file_descriptor_sink closing file handle

Hi, I'm using file_descriptor_sink to obtain a stream to a given file handle. It's important that the file remain open past the lifetime of that object, so I send in false as the second parameter to the constructor (close_on_exit). It seems the file is being closed anyway. Here is an example: #include <iostream> #include <boost/iostreams/stream.hpp> #include <boost/iostreams/device/file_descriptor.hpp> int main(int argc, const char *argv[]) { std::cout << "foo" << std::endl; { boost::iostreams::stream<boost::iostreams::file_descriptor_sink> stream(fileno(stdout), false); stream << "bar" << std::endl; } std::cout << "baz" << std::endl; return 0; } Here we expect foo bar baz to be written, when only foo bar is written. Note that the output is the same regardless of whether true or false is sent into the constructor. Is this a boost bug, or is there something I'm missing here? I'm using gcc 4.3.4 on Ubuntu 10.04 if that makes any difference. Thanks, Scott Quiring
participants (1)
-
Scott Quiring