Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!milton!sumax!amc-gw!jwbirdsa From: jwbirdsa@amc.com (James Birdsall) Newsgroups: comp.os.msdos.programmer Subject: Re: Sensing STDOUT redirection in C Keywords: STDOUT, Redirection, MSDOS Message-ID: <1991Apr18.165820.6035@amc.com> Date: 18 Apr 91 16:58:20 GMT References: <1991Apr16.145847.20316@midway.uchicago.edu> Reply-To: jwbirdsa@europa.amc.com (James Birdsall) Organization: Applied Microsystems, Redmond, WA Lines: 16 In article <1991Apr16.145847.20316@midway.uchicago.edu> valley@gsbsun.uchicago.edu (Doug Dougherty) writes: >collinsa@p4.cs.man.ac.uk (Adrian Collins) writes: >>Does anybody know how to sense whether output redirection has been used >>on the command line? >isatty(1) >(Works in Turbo C) Well, almost. isatty() returns true if the supplied handle is the console *or* a printer or serial port. Determining whether the handle is actually the console or not requires an ioctl() and checking some bits. -- James W. Birdsall WORK: jwbirdsa@amc.com {uunet,uw-coco}!amc-gw!jwbirdsa HOME: {uunet,uw-coco}!amc-gw!picarefy!jwbirdsa OTHER: 71261.1731@compuserve.com ================== Kitten: a small homicidal muffin on legs. ================== =========== "For it is the doom of men that they forget." -- Merlin ===========