Article View: comp.windows.ms.programmer
Article #2425Re: What to do about stdin, stdout, and stderr under Windows 3.0?
From: David A Keldsen
Date: Tue, 07 May 1991 21:33
Date: Tue, 07 May 1991 21:33
45 lines
2516 bytes
2516 bytes
>In article <1991Apr30.162028.7771@sq.sq.com> I wrote:
><On reading through the includes for the SDK, I see that std{in,out,err} are
><not supported under Windows. While this isn't entirely surprising, what do
><you do to substitute for them? (On Unix, I'd consider opening /dev/null,
><but there isn't one that I can find for DOS/MS-WINDOWS.)
mlord@bwdls58.bnr.ca (Mark Lord) writes:
>There is a device called NUL for use in the PC world. NUL == /dev/null
Nice idea, but apparently "NUL" is magical to command.com. fopen() in
the MSC libraries certainly doesn't do anything useful with "NUL" or
"NUL:"
I guess it's time for the summary, so here are the replies that I
received in the mail:
(1) /dev/null doesn't work, but /dev/nul *does*.
(Ick! It works empirically, but I don't know if I trust MS not to
change it, as it sounds like a bug.)
(2) You shouldn't be using streams under Windows anyhow, read Petzold's
book on Windows programming and redirect the output to a window.
(Not applicable at this stage in development, although it's useful
information; clearly this is the model intended for MS-WINDOWS, but
for this particular purpose, tossing the output to /dev/null is
just as useful.)
(3) Try NUL
(Doesn't work.)
So, what I'm going to do is...none of the above. We're using a higher-level
"port" abstraction for what we're doing, and we've created a "null port"
which takes care of the problem and doesn't even use stdio. Someday, it'll
do the appropriate magic for windowing systems...
Thanks (in no particular order) to:
cs352a41@zaphod.cs.iastate.edu. (Adam Goldberg)
rogerhef@matt.ksu.ksu.edu (Roger Heflin)
poffen@sj.ate.slb.com (Russ Poffenberger)
Regards,
Dak
--
David A. 'Dak' Keldsen of SoftQuad, Inc. email: dak@sq.com phone: 416-963-8337
"It is well known that _things_ from undesirable universes are always seeking
entrance into this one, which is the psychic equivalent of handy for the
buses and closer to the shops." -- Terry Pratchett, _The Light Fantastic_
Technical Details
Message-ID:
<1991May7.213347.709@sq.sq.com>Path:
arc1-ca.pugleaf.net!utzoo!sq!dakReferences:
<1991Apr30.162028.7771@sq.sq.com> <6690@bwdls58.bnr.ca>Show Full Headers
Complete Article Headers
Newsgroups: comp.windows.ms.programmer,comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!utzoo!sq!dak From: dak@sq.sq.com (David A Keldsen) Subject: Re: What to do about stdin, stdout, and stderr under Windows 3.0? Message-ID: <1991May7.213347.709@sq.sq.com> Keywords: Missing in action Organization: SoftQuad Inc. References: <1991Apr30.162028.7771@sq.sq.com> <6690@bwdls58.bnr.ca> Date: Tue, 7 May 91 21:33:47 GMT Lines: 45