Xref: utzoo comp.unix.questions:11902 comp.unix.xenix:5136 Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!decwrl!sun!pitstop!sundc!seismo!uunet!pdn!boake2!sherpa!rac From: rac@sherpa.UUCP (Roger A. Cornelius) Newsgroups: comp.unix.questions,comp.unix.xenix Subject: How to determine file being redirected to in C Keywords: redirection Message-ID: <10@sherpa.UUCP> Date: 27 Feb 89 07:23:39 GMT Distribution: na Organization: Personal System Computing, St. Petersburg, FL Lines: 15 I've been searching for the past several days for references to this, but haven't been able to find it. I know I've read it somewhere, or maybe saw it here. Anyway, can someone tell me how to determine (in C) if output is being redirected, or more precisely, how to determine the file output is being redirected to. The cat command does this (at least the Xenix version of cat, I don't think the BSD version does), i.e.: cat catfile > catfile produces the error "cat: input catfile is output". Any help appreciated. Roger rac@sherpa uunet!sherpa!rac