Path: utzoo!utgpu!attcan!uunet!helios!scs!cognos!bradc From: bradc@cognos.uucp (Brad Cameron) Newsgroups: comp.sys.ibm.pc Subject: Re: How to determine stdin/out redirection Message-ID: <4149@cognos.UUCP> Date: 29 Sep 88 17:56:24 GMT References: <9465@cup.portal.com> Reply-To: bradc@cognos.UUCP (Brad Cameron) Organization: Cognos Inc., Ottawa, Canada Lines: 18 In article <9465@cup.portal.com> Steve_R_Calwas@cup.portal.com writes: >Is there a way for an application program to determine whether or not its >standard input and/or standard output are being redirected? > Microsoft C has a library function called isatty which can be used for this purpose. The following function will return non-zero if neither standard input or standard output are redirected: int Interactive () { return isatty ( fileno (stdin) ) && isatty ( fileno (stdout) ); } -- Brad Cameron uucp: decvax!utzoo!dciem!nrcaer!cognos!bradc Cognos Incorporated mail: P.O. Box 9707, 3755 Riverside Drive, (613) 738-1440 Ottawa Ontario, Canada. K1G 3Z4