//Purpose: // Explore differences in ways iostreams filtering is done // with different device types. //Acknowledgements: // Original code from post: /* From: Ken Appleby Newsgroups: gmane.comp.lib.boost.user Subject: Re: [iostreams] How can I use the Stream Insertion operator (<<) with a filtering_streambuf? Date: Fri, 26 Jul 2013 18:06:47 +0100 Lines: 94 */ //ChangeLog: // 2013-07-29.0847 // Converted to use: // filtering_estream // instead of: // filtering_streambuf // after reading post: /* From: Stephen Greenfield Newsgroups: gmane.comp.lib.boost.user Subject: Re: [iostreams] How can I use the Stream Insertion operator (<<) with a filtering_streambuf? Date: Mon, 29 Jul 2013 04:28:04 +0000 Lines: 167 */ //========================== #include #define USE_STRINGSTRM //use stringstream instead of fstream. #ifdef USE_STRINGSTRM #include #else #include #endif #include #include #define USE_FILT_COMPRESS #ifdef USE_FILT_COMPRESS #include #else #include #include #endif int main() { std::cout<<"USE_STRINGSTRM=" #ifdef USE_STRINGSTRM <<"yes defined" #else <<"not defined" #endif <<"\n"; std::cout<<"USE_FILT_COMPRESS=" #ifdef USE_FILT_COMPRESS <<"yes defined" #else <<"not defined" #endif <<"\n"; std::ios::openmode const ios_binary= std::ios::binary ; std::cout<<"ios_binary="< filter(filter_val); #endif out.push( filter ); out.push( myOstrm ); out << "text to be in the file..."; #ifdef USE_STRINGSTRM out.flush(); strmValue=myOstrm.str(); #endif #ifdef USE_FILT_COMPRESS #else std::cout<<"characters="< filter(filter_val); #endif inp.push( filter ); inp.push( myIstrm ); std::string text; unsigned count=0; while ( inp.good() ) { char ch = inp.get(); int ic=ch; ++count; std::cout<<"get["<