www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12815] New: Dummy file

https://issues.dlang.org/show_bug.cgi?id=12815

          Issue ID: 12815
           Summary: Dummy file
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody puremagic.com
          Reporter: maximzms gmail.com

It would be nice to have a file similar to stdout or stderr that does nothing,
say, stdnull.
It is useful when one needs to suppress some output (e.g. when --silent flag is
sent to the program).

On Linux the following code does the trick:
--------------------
File stdnull;

static this()
{
    version(Posix)
    {
        stdnull = File("/dev/null", "w");
    }
}
--------------------

What about other systems?

--
May 28 2014