digitalmars.D.learn - Redirect stdout and stderr.
- Tobias Pankrath (4/4) Jul 03 2012 Is it possible to redirect stdout in a way that all following
- Tobias Pankrath (2/6) Jul 03 2012 And I need to restore them afterwards.
- Artur Skawina (4/6) Jul 03 2012
- Tobias Pankrath (9/16) Jul 03 2012 Thank you. After a first search, thought I need to use dup2,
- Wouter Verhelst (8/10) Jul 03 2012 If it's any form of unix, all you need to do is close(1). If you still
Is it possible to redirect stdout in a way that all following calls to writeln etc just write to /dev/null or something similar? Thanks!
Jul 03 2012
On Tuesday, 3 July 2012 at 18:30:41 UTC, 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? Thanks!And I need to restore them afterwards.
Jul 03 2012
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
Jul 03 2012
On Tuesday, 3 July 2012 at 18:39:09 UTC, Artur Skawina wrote:On 07/03/12 20:30, Tobias Pankrath wrote: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;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
Jul 03 2012
"Tobias Pankrath" <tobias pankrath.net> writes:Is it possible to redirect stdout in a way that all following calls to writeln etc just write to /dev/null or something similar?If it's any form of unix, all you need to do is close(1). If you still need the fd afterwards, you want to use dup() first so you can restore them (with dup2()) later. -- The volume of a pizza of thickness a and radius z can be described by the following formula: pi zz a
Jul 03 2012