From 50b89841463d7724e7e20dad19da8bd61d49a06c Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 5 Sep 2012 21:23:44 +0000 Subject: Bu::StdStream can be set to print to stderror now, and sio.h now declares serr and serrRaw. Also, they are now StreamStacks, which means you can change what type of stream they read/write to, and also add filters. --- src/stable/stdstream.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/stable/stdstream.cpp') diff --git a/src/stable/stdstream.cpp b/src/stable/stdstream.cpp index 9bc22f2..25ad8d4 100644 --- a/src/stable/stdstream.cpp +++ b/src/stable/stdstream.cpp @@ -8,7 +8,8 @@ #include #include "bu/stdstream.h" -Bu::StdStream::StdStream() +Bu::StdStream::StdStream( OutMode eOut ) : + eOut( eOut ) { } @@ -27,7 +28,7 @@ Bu::size Bu::StdStream::read( void *pBuf, Bu::size nBytes ) Bu::size Bu::StdStream::write( const void *pBuf, Bu::size nBytes ) { - return fwrite( pBuf, 1, nBytes, stdout ); + return fwrite( pBuf, 1, nBytes, eOut==StdOut?stdout:stderr ); } Bu::size Bu::StdStream::tell() @@ -59,7 +60,7 @@ bool Bu::StdStream::isOpen() void Bu::StdStream::flush() { - fflush( stdout ); + fflush( eOut==StdOut?stdout:stderr ); } bool Bu::StdStream::canRead() -- cgit v1.2.3