🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #5837

Re: Sensing STDOUT redirection in C

#5837
From: James Birdsall
Date: Thu, 18 Apr 1991 16:58
16 lines
1409 bytes
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 ===========
Technical Details
Message-ID: <1991Apr18.165820.6035@amc.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!uwm.edu!ogicse!milton!sumax!amc-gw!jwbirdsa
References: <collinsa.671721083@p4.cs.man.ac.uk> <1991Apr16.145847.20316@midway.uchicago.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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: <collinsa.671721083@p4.cs.man.ac.uk> <1991Apr16.145847.20316@midway.uchicago.edu>
Reply-To: jwbirdsa@europa.amc.com (James Birdsall)
Organization: Applied Microsystems, Redmond, WA
Lines: 16