Xref: utzoo comp.unix.questions:11943 comp.unix.xenix:5165 Path: utzoo!attcan!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.unix.questions,comp.unix.xenix Subject: Re: How to determine file being redirected to in C Keywords: redirection Message-ID: <1104@auspex.UUCP> Date: 1 Mar 89 20:13:06 GMT References: <10@sherpa.UUCP> <7419@pyr.gatech.EDU> Reply-To: guy@auspex.UUCP (Guy Harris) Distribution: na Organization: Auspex Systems, Santa Clara Lines: 10 >You may want to investigate the isatty() function call. I believe that >you can use something like: isatty(stdout) which will tell you if >standard out is going to a terminal (the usual case), or if it has been >redirected via a pipe or into a file. We've been here before. No, "isatty(stdout)" won't tell you anything of the sort. "isatty" takes a file descriptor, *not* a standard I/O "FILE *". "isatty(fileno(stdout))", or "isatty(1)", will tell you whether the standard output is a tty or not.