Xref: utzoo comp.lang.c:27303 comp.sys.ibm.pc.programmer:622 Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!pt.cs.cmu.edu!b.gp.cs.cmu.edu!ralf From: ralf@b.gp.cs.cmu.edu (Ralf Brown) Newsgroups: comp.lang.c,comp.sys.ibm.pc.programmer Subject: Re: How to tell if stdin/stdout is redirected? Message-ID: <8647@pt.cs.cmu.edu> Date: 28 Mar 90 21:49:25 GMT References: <807@tsdiag.ccur.com> Organization: Carnegie-Mellon University, CS/RI Lines: 18 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.