🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.pc
Article #6138

How to tell if stdout is console

#6138
From: Glenn Connery
Date: Sat, 05 Apr 1986 21:03
14 lines
1178 bytes
...
In writing a number of utilities it has become desirable to be able to
tell automatically if stdout has been redirected or not.  For example
in writing a directory lister which uses color through the BIOS it
should automatically go back to normal DOS I/O if the device is not
the console.  I can do this through fstat or isatty in MSC 3.0 if the
redirected device is a file and not a device, but I can't tell if the
user has redirected stdout to the printer or another device.

Any ideas?
-- 

Glenn Connery, Bell Northern Research, Mountain View, CA
{hplabs,amdahl,3comvax}!bnrmtv!connery
Technical Details
Message-ID: <299@bnrmtv.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!sun!amdahl!bnrmtv!connery

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.2 9/18/84; site bnrmtv.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!bellcore!decvax!decwrl!sun!amdahl!bnrmtv!connery
From: connery@bnrmtv.UUCP (Glenn Connery)
Newsgroups: net.micro.pc
Subject: How to tell if stdout is console
Message-ID: <299@bnrmtv.UUCP>
Date: Sat, 5-Apr-86 16:03:05 EST
Article-I.D.: bnrmtv.299
Posted: Sat Apr  5 16:03:05 1986
Date-Received: Wed, 9-Apr-86 08:02:53 EST
Distribution: net
Organization: Bell Northern Research, Mtn. View, CA
Lines: 14