Article View: net.micro.pc
Article #6150Re: How to tell if stdout is console
From: Donald L. Nash
Date: Mon, 07 Apr 1986 16:11
Date: Mon, 07 Apr 1986 16:11
33 lines
1820 bytes
1820 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
Use the IOCTL DOS function. Look it up in the DOS manual, it is
function 0x44. You want subfunction 0. I needed to determine the same
thing about stdin at wone time. This will do it. I believe that MSC
3.0 will allow you to make direct calls to DOS, won't it? I haven't
used MSC, but in CII C86, there is a function sysint21() which allows
you to make calls to DOS.
Hope this helps...
Don Nash
UUCP: ...!{ihnp4,allegra,seismo!ut-sally}!ut-ngp!dlnash
APRA: dlnash@ngp.CC.UTEXAS.EDU
BITNET: cceu001@utadnx
"If you can't say something nice, then don't" -- anonymous
Technical Details
Message-ID:
<3173@ut-ngp.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!princeton!orsvax1!pyrnj!caip!lll-crg!mordor!ut-sally!ut-ngp!dlnashReferences:
<299@bnrmtv.UUCP>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!allegra!princeton!orsvax1!pyrnj!caip!lll-crg!mordor!ut-sally!ut-ngp!dlnash From: dlnash@ut-ngp.UUCP (Donald L. Nash) Newsgroups: net.micro.pc Subject: Re: How to tell if stdout is console Message-ID: <3173@ut-ngp.UUCP> Date: Mon, 7-Apr-86 11:11:33 EST Article-I.D.: ut-ngp.3173 Posted: Mon Apr 7 11:11:33 1986 Date-Received: Thu, 10-Apr-86 00:34:02 EST References: <299@bnrmtv.UUCP> Distribution: net Organization: UTexas Computation Center, Austin, Texas Lines: 33