Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.3 alpha 4/15/85; site elsie.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!houxm!mtuxo!mtunh!mtung!mtunf!ariel!vax135!cornell!uw-beaver!tektronix!hplabs!pesnta!qumix!ittvax!decvax!genrad!panda!talcott!harvard!seismo!elsie!ken
From: ken@elsie.UUCP (Ken Brown)
Newsgroups: net.micro.pc
Subject: how do you detect redirection
Message-ID: <5156@elsie.UUCP>
Date: Tue, 9-Jul-85 11:26:46 EDT
Article-I.D.: elsie.5156
Posted: Tue Jul  9 11:26:46 1985
Date-Received: Sat, 13-Jul-85 14:59:26 EDT
Organization: Data Resources, Inc.
Lines: 24

The new Microsoft C compiler includes the isatty() function in the
standard library.  Unfortunately, it seems to work differently
than the UNIX function by the same name.
Apparently, under DOS isatty() can only detect the difference
between a device (any device) and a file.  Therefore, isatty()
returns true if a file handle is attached to the console or to
a printer, unlike the UNIX isatty() which returns false it the
handle is attached to a printer.

My question is, does anyone know how to detect whether or not
the standard output has been redirected to a printer port
(lpt1, etc.)?

I've looked at all of the information in the FILE structure.  I
can't find anything useful there.  I also looked at the DOS
function 44h (IOCTL), but apparently it does not distinguish different
devices in any way either.

Any clues would be appreciated.

Thanks in advance,
Ken Brown
Data Resources, Inc.
...!decvax!allegra!umcp-cs!elsie!ken