How does one know if the stdin is from the console, a pipe,
or redirected from other file? Is there a standard way to get
that information, or it's different for each platform? If so,
what are the ways for DOS, UNIX, Win32 console mode?
Thanks.
Isaac Chen
One doesn't.
> Is there a standard way to get
> that information, or it's different for each platform?
No.
> If so,
> what are the ways for DOS, UNIX, Win32 console mode?
I *strongly* suggest not knowing.
First, your code will need to be compiled under different conditions
on each platform. This is not good. And you'll have to maintain
the different versions as new platforms emerge. (Consider that your
list leaves out the Macs and RISC OS, for example.)
Second, *why* do you need to know? The usual reason is so that
your code can prompt (or not). I've deal with this by having a
command-line argument; eg the default can be "no prompt" and
specifying `-prompt="spoo- "` encourages you with spoo (it's
quite fresh, ambassador).
--
Chris "or use -noprompt" Dollin
C FAQs at: http://www.faqs.org/faqs/by-newsgroup/comp/comp.lang.c.html