-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
sr*****@sbcglobal.net wrote:
Can a program detect if it's stdin is
coming from keyboard input vs. being
redirected from a file?
Not in standard C, it can't.
But, with a platform-specific extension, it often can.
If it's from a file, I want to fputs()
the text. But if it's from the keyboard,
I won't (don't want it typed, then
fputs()'d.
You'll either have to resort to some sort of signal data (like a command
argument), or use a platform-specific extension to determine whether stdin
comes from a file or an interactive device.
- --
Lew Pitcher
Master Codewright & JOAT-in-training | GPG public key available on request
Registered Linux User #112576 (
http://counter.li.org/)
Slackware - Because I know what I'm doing.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.7 (GNU/Linux)
iD8DBQFDD7VAagVFX4UWr64RAi2yAJ9M7NGcb3z4zRVIkuJ8Eg 7WKaQdFQCfYBie
Wl2MOzXg/kxLYBvIVGwErRw=
=Fiqc
-----END PGP SIGNATURE-----