How to determine file being redirected to in C
Ray Curci scri
curci at stat.uucp
Tue Feb 28 14:14:21 AEST 1989
In article <10 at sherpa.UUCP> rac at sherpa.UUCP (Roger A. Cornelius) writes:
>... 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.
>Roger rac at sherpa
> uunet!sherpa!rac
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.
ray curci
florida state university supercomputer institute
curci at stat.fsu.edu, curci at nu.cs.fsu.edu
More information about the Comp.unix.questions
mailing list