stdout redirect

Rikki Cattermole via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 12 18:28:52 PDT 2015


On 13/04/2015 1:12 a.m., FreeSlave wrote:
> On Sunday, 12 April 2015 at 04:39:06 UTC, Philip Stuckey wrote:
>> why not:
>> import std.stdio;
>> stdout = File(args[4], "w+");
>> stderr = File(args[4], "w+");
>
> It just replaces the object, not redirects output. E.g. if you use
> printf somewhere it will use stdout, not file.

You will need to use writefln instead of printf. As printf uses the 
processes stdout. Changing this would be tricky and OS based.


More information about the Digitalmars-d-learn mailing list