
7 Dec
2006
7 Dec
'06
6:48 a.m.
Maurice van Swaaij wrote:
Hi,
Is there a way to set a filtering_stream to binary mode so I can use its operator>> and operator<< to read and write binary data?
Thanks.
I use ios_base::binary when I open the stream. Search the old newsgroup messages... there was some caution made about using << and >> with binary data. The recommendation was to use read and write instead. namespace io = boost::iostreams; io::filtering_ostream out; out.push(io::gzip_compressor()); out.push( io::file_sink("my_file.gz", ios_base::out | ios_base::binary)); NOW you can write to out