Bug 12815 – Dummy file

Status
ASSIGNED
Severity
enhancement
Priority
P4
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-05-28T11:57:45Z
Last change time
2024-12-01T16:21:17Z
Assigned to
No Owner
Creator
Maksim Zholudev
Moved to GitHub: phobos#10057 →

Comments

Comment #0 by maximzms — 2014-05-28T11:57:45Z
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?
Comment #1 by justin — 2014-07-11T18:02:46Z
Comment #2 by code — 2014-07-11T18:07:35Z
I also needed something like this a while back (also for input, though), so I agree that having it in Phobos would be nice. (In reply to Maksim Zholudev from comment #0) > What about other systems? NUL should do the trick on Windows, I think.
Comment #3 by robert.schadek — 2024-12-01T16:21:17Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/phobos/issues/10057 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB