Can I pipe an
OutputStream object created by
OpenWrite (or similar) to a notebook instead of a file? I am aware that I can use
NotebookWrite, but I want to have all the
Write statements in my code to be redirected to file/notebook by simply switching a variable.
I am not sure that this is possible. The
If you remove
All this suggest that it's not possible to redirect an output stream to an arbitrary notebook.
Instead of using output streams to switch the output "device", I'd suggest switching the output function. You could have a function
If you already have a lot of code using
If you need to temporarily redefine
Note: As @Heike said below,