How to determine the destination of standard output?
Bernd Felsche
bernie at metapro.DIALix.oz.au
Sat Feb 9 16:06:16 AEST 1991
In <1991Feb6.204432.2850 at cubmol.bio.columbia.edu> ping at cubmol.bio.columbia.edu (Shiping Zhang) writes:
>I'm not sure if this subject has be discussed before. I want to know
>if there is a way to tell within a program where its standard output
>goes. More specifically, if the output goes to the terminal screen, or
>goes to a pipe, or is redirected into a disk file. Thanks for any info.
Refer to fstat(2) for System V.
This gives you inode info for a file descriptor.
There is also isatty(3), which tells you if it is.
--
_--_|\ Bernd Felsche #include <std/disclaimer.h>
/ \ Metapro Systems, 328 Albany Highway, Victoria Park, Western Australia
\_.--._/ Fax: +61 9 472 3337 Phone: +61 9 362 9355 TZ=WST-8
v E-Mail: bernie at metapro.DIALix.oz.au | bernie at DIALix.oz.au
More information about the Comp.unix.programmer
mailing list