jeffs@tsdiag.ccur.com (Jeff Schnell) (03/28/90)
I would like to know if there is a way to tell if stdin/stdout is redirected. I would like it in Turbo C and/or Microsoft C and also in unix. Thanks Jeffs -- Jeffrey J. Schnell System Support Eng. | Concurrent Computer Corp. FAX: 201-870-4249 Ph: (201) 870-4120 | 2 Crescent Place, M/S 117 UUCP: rutgers!petsd!tsdiag!jeffs | Oceanport NJ, 07757 INTERNET: jeffs@tsdiag.ccur.com
ralf@b.gp.cs.cmu.edu (Ralf Brown) (03/29/90)
In article <807@tsdiag.ccur.com> jeffs@tsdiag.ccur.com (Jeff Schnell) writes: }I would like to know if there is a way to tell if stdin/stdout }is redirected. I would like it in Turbo C and/or Microsoft C }and also in unix. isatty(fileno(stdin)) works for me under Turbo C (returns nonzero iff stdin points at a character device such as CON, PRN, etc) and should work under Unix (since that is where isatty originated). -- {backbone}!cs.cmu.edu!ralf ARPA: RALF@CS.CMU.EDU FIDO: Ralf Brown 1:129/46 BITnet: RALF%CS.CMU.EDU@CMUCCVMA AT&Tnet: (412)268-3053 (school) FAX: ask DISCLAIMER? | _How_to_Prove_It_ by Dana Angluin 3. by vigorous handwaving: What's that?| Works well in a classroom or seminar setting.