GUI and non-GUI stream usage?
Bill Baxter
dnewsgroup at billbaxter.com
Sun Nov 18 12:46:28 PST 2007
Bill Baxter wrote:
>>> It seems all the dout, derr streams defined in std.cstream throw
>>> exceptions if they're unable to write their output.
Correction: I just realized that dout does *NOT* throw an exception, but
derr does. Whether exceptions should be thrown or not, that seems like
inconsistent behavior to me.
> Failing that, I guess if there's a way I can freopen stdout/stderr to
> /dev/null on Windows that will do it. I'll give that a try.
This does seem to work, for anyone who's interested.
version (Windows) {
std.c.stdio.freopen("Nul", "w", derr.file);
}
And the exceptions go away.
In the bigger picture it would be nice if I could rebind dout and derr
to a different Stream so that I could write a GUI StreamLogger class.
From the rumblings I hear, I'm guessing that sort of thing is probably
possible in Tango?
--bb
More information about the Digitalmars-d-learn
mailing list