iostreams::stream: flush doesn't work but endl does
Hi all,
I've created my own iostreams device (for a serial port) which for
debugging purposes prints out calls to read()/write().
I'm constructing a stream on the device like this:
serial_device serial("/dev/ttyS3", serial_device::Baud38400);
stream
boost-users-bounces@lists.boost.org, le 23 janvier 2008 07:07:
Hi all,
I've created my own iostreams device (for a serial port) which for debugging purposes prints out calls to read()/write().
I'm constructing a stream on the device like this: serial_device serial("/dev/ttyS3", serial_device::Baud38400); stream
s(serial); If I do this: s << "hello world" << endl; serial.write() is called and does its debug output, but with this: s << "hello world\r" << flush; I get nothing despite using 'flush'.
I've also tried calling s.flush() manually but get the same lack of effect. How come flush isn't working as it should here?
A wild guess: Does serial_device implement the "Flushable" concept? http://www.boost.org/libs/iostreams/doc/index.html?path=4.1.3.2 Éric Malenfant ---------------------------------------------
It does now ;-)
Apologies for what may have been a stupid question - it's not that I didn't
look at the documentation, more that - as I've found with attempting to
extend the C++ standard iostream library - it doesn't seem that clear how to
achieve a certain task and why things have to be done a certain way.
Thanks for the help again :-)
--rob
On Jan 23, 2008 2:36 PM, Eric MALENFANT
boost-users-bounces@lists.boost.org, le 23 janvier 2008 07:07:
Hi all,
I've created my own iostreams device (for a serial port) which for debugging purposes prints out calls to read()/write().
I'm constructing a stream on the device like this: serial_device serial("/dev/ttyS3", serial_device::Baud38400); stream
s(serial); If I do this: s << "hello world" << endl; serial.write() is called and does its debug output, but with this: s << "hello world\r" << flush; I get nothing despite using 'flush'.
I've also tried calling s.flush() manually but get the same lack of effect. How come flush isn't working as it should here?
A wild guess: Does serial_device implement the "Flushable" concept? http://www.boost.org/libs/iostreams/doc/index.html?path=4.1.3.2
Éric Malenfant --------------------------------------------- _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- Rob Desbois Eml: rob.desbois@gmail.com Tel: 07946 705987 "There's a whale there's a whale there's a whale fish" he cried, and the whale was in full view. ...Then ooh welcome. Ahhh. Ooh mug welcome.
participants (2)
-
Eric MALENFANT
-
Rob Desbois