Hello,

I use this code excerpt for copy file content:

bio::stream< bio::basic_file_source<char> > l_file(p_str1);
if (!l_file.is_open())
    throw exception::runtime(_("file can not be opened"));
std::copy( std::istream_iterator<char>(l_file), std::istream_iterator<char>(), std::ostreambuf_iterator<char>(&l_deflate) );
(*)
l_file.close();

p_str1 is the filename and bio ist shorten for boost::iostreams, l_deflate is a bio::filtering_streambuf< bio::output > with a bzip2 compressor.
I can set anything else to p_str1 (some not existing filesnames) and the code runs not into the if construction, the std::copy seems to copy any data, but which if there is no file under the stream !?

The l_deflate is define with:

bio::counter l_counter;
bio::basic_null_sink<char> l_null;
bio::filtering_streambuf< bio::output > l_deflate;


l_deflate.push( bio::bzip2_compressor( m_bzip2param ) );    break;


l_deflate.push( boost::ref(l_counter) );        
l_deflate.push( l_null );

I would count the compressed bytes of a file (without writing the file), but I need to copy the filecontent without closing after copying, so I can't use boost::iostream::copy (it closes the streams after copy). On the (*) can be some other std::copy with other files

Can anyone help me please to create a correct code ? Thanks a lot

Phil