RE: [boost] Re: boost::iostreams: only with std::cout?

Hi Jonathan, Thanks for helping me out!! I've tried your proposition below and it does the trick, even with actual encryption going on: out << "test" << std::endl; //this works //out << "test" << "\n"; //this does not One remark: he code above works on my vc71 debug setup (cl called through bjam v2 build v10), but if I read your earlier mail correctly it should be the other way around and hang as well? One question: is this behaviour intended? I will try some more stuff (with some other containers , the copy/adapt etc) and source/sink - apart from encryption I am in need of a audio source/sink. I'll let you know :) - It's great stuff! Cheers, Dirk (Sorry the code didn't compile, forgot to match the filter names). (And what do you mean by 'red herring' ? :) -----Original Message----- From: boost-bounces@lists.boost.org [mailto:boost-bounces@lists.boost.org] On Behalf Of Jonathan Turkanis Sent: Tuesday 22 March 2005 22:32 To: boost@lists.boost.org Subject: [boost] Re: boost::iostreams: only with std::cout? Dirk Griffioen wrote:
I would love to use the boost::iostreams lib, so I created a filter (which, in this case, does encryption)
but instead of passing it std::cout I would like to pass it some other stream, a stringstream for instance (or any kind of ostream/istream, depending on the direction).
However, I was very surprised to find the following code taking 100% cpu and not returning. It probably means I did something wrong, but I can't seem to find it.
Here's a cleaned up example that reproduces the bug (when endl is replaces by "\n"). It seems the filter is a red herring. Jonathan #include <iostream> #include <sstream> #include <boost/iostreams/filtering_stream.hpp> int main() { boost::iostreams::filtering_ostream out; std::ostringstream os; out.push(os); out << "test" << std::endl; //out << "test" << "\n"; std::cout << os.str(); } _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this email in error please notify our system management at postmaster@optiver.com and immediately and permanently delete this message and any attachments. ********************************************

From: "Dirk Griffioen" <dirkgriffioen@optiver.com>
(And what do you mean by 'red herring' ? :)
- in detective work, mystery fiction, and puzzle-solving, a false clue which leads investigators, readers, or solvers towards an incorrect solution -- Rob Stewart stewart@sig.com Software Engineer http://www.sig.com Susquehanna International Group, LLP using std::disclaimer;

From the Department of Useless Knowledge ...
Red Herrings after some smoking and curing had a truly fearsome smell, and were used for laying a scent trail to mask another trail so that it could not easily be followed. Paul Paul A Bristow Prizet Farmhouse, Kendal, Cumbria UK LA8 8AB +44 1539 561830 +44 7714 330204 mailto: pbristow@hetp.u-net.com | -----Original Message----- | From: boost-bounces@lists.boost.org | [mailto:boost-bounces@lists.boost.org] On Behalf Of Rob Stewart | Sent: 23 March 2005 16:42 | To: boost@lists.boost.org | Cc: boost@lists.boost.org | Subject: Re: [boost] Re: boost::iostreams: only with std::cout? | | From: "Dirk Griffioen" <dirkgriffioen@optiver.com> | > | > (And what do you mean by 'red herring' ? :) | | >From http://en.wikipedia.org/wiki/Red_herring: | | - in detective work, mystery fiction, and puzzle-solving, a false | clue which leads investigators, readers, or solvers towards an | incorrect solution | | -- | Rob Stewart stewart@sig.com | Software Engineer http://www.sig.com | Susquehanna International Group, LLP using std::disclaimer; | _______________________________________________ | Unsubscribe & other changes: | http://lists.boost.org/mailman/listinfo.cgi/boost |

Dirk Griffioen wrote:
Hi Jonathan,
Thanks for helping me out!!
Glad to help.
I've tried your proposition below and it does the trick, even with actual encryption going on:
out << "test" << std::endl; //this works //out << "test" << "\n"; //this does not
One remark: he code above works on my vc71 debug setup (cl called through bjam v2 build v10), but if I read your earlier mail correctly it should be the other way around and hang as well?
What I was trying to say was that the problem occured with "\n" but not endl.
One question: is this behaviour intended?
Definitely not -- I'm going to try to fix it.
I will try some more stuff (with some other containers , the copy/adapt etc) and source/sink - apart from encryption I am in need of a audio source/sink.
I'll let you know :) - It's great stuff!
Thanks!
Cheers, Dirk
Jonathan
participants (4)
-
Dirk Griffioen
-
Jonathan Turkanis
-
Paul A Bristow
-
Rob Stewart