Philipp Kraus wrote:On 2010-06-11 09:34:27 +0200, Roland Bock said:Kraus Philipp wrote:Hi,on my previous posting I have another questing:I create my compression stream withbio::filtering_streambuf< bio::input > l_deflate;switch (m_compress) {case gzip : l_deflate.push( bio::gzip_compressor() );break;case bzip2 : l_deflate.push( bio::bzip2_compressor() );break;}For a single file I push it to zip with:l_deflate.push( bio::file_source(p_str1, BOOST_IOS::binary) );I need a concatination for two files like:l_deflate.push( bio::file_source(p_str1, BOOST_IOS::binary) );l_deflate.push( bio::file_source(p_str2, BOOST_IOS::binary) );for unix shell I do this with:cat file1.txt > tozip.txtcat file2.txt >> tozip.txtHow I can push a concatinated file to the deflate stream buffer?ThanksPhilHi,I see two options:a) You write a new multi_file_source class which can any number of inputfiles.b) Instead of working with a source, you could work with a sink at theother end of the pipeline. Then just copy the content of the two filesinto the stream.Hi,I think I would like to use the second idea, but how I can do this?ThxPhilHi,
currently, all your examples are using filtering input streams with a source. For concatination and compression I would use a filtering output stream and a sink (for instance a file sink).
Then you open an ifstream for the first file and copy its content into the filtering output stream.
Then you open an ifstream for the second file and copy its content into the filtering output stream.