Redirect stdout and stderr.
Tobias Pankrath
tobias at pankrath.net
Tue Jul 3 11:56:33 PDT 2012
On Tuesday, 3 July 2012 at 18:39:09 UTC, Artur Skawina wrote:
> On 07/03/12 20:30, Tobias Pankrath wrote:
>> Is it possible to redirect stdout in a way that all following
>> calls to
>> writeln etc just write to /dev/null or something similar?
>
> stdout.open(outfilename, "wt");
>
> artur
Thank you. After a first search, thought I need to use dup2,
freopen etc.
If someone finds this thread, this is how to restore stdout:
Just store it in another variable like this.
auto original = stdout;
stdout.open(newdest, "wt");
//restore
stdout = original;
More information about the Digitalmars-d-learn
mailing list