How to find out if stdout is piped?

Eli B. Charne echarne at orion.oac.uci.edu
Wed Feb 14 18:03:43 AEST 1990


phd_ivo at gsbacd.uchicago.edu writes:

>In Mach (a BSD 4.3 clone), is there an easy way to
>find out if stdout is hooked to a pipe, or redirected
>into a file?

  Yes.

  Use the library routine isatty()

     isatty(filedes)

     Isatty returns 1 if filedes is associated with a terminal
     device, 0 otherwise.

						     -Eli

-- 
--------
Eli B. Charne              INTERNET: echarne at ORION.OAC.UCI.EDU
			     BITNET: echarne at UCI.BITNET



More information about the Comp.unix.questions mailing list