Donald@cup.portal.com (Donald W Randolph) (01/13/91)
Here is a function the Turbo gurus gave me from the Borland programming
forums on CompuServe. It works for me with TP5.5 under MS-DOS 4.01.
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
FUNCTION IsConsole (VAR TextFile : TEXT) : Boolean;
{ Supplied by Philippe Ranger (TeamB) 71531,1350 via CI$ BPROGA. It
returns TRUE if the parameter is really the STDOUT console. FALSE
is returned if the parameter is a file or STDOUT redirected to a file.
}
VAR
Regs : Registers;
BEGIN
WITH Regs DO
BEGIN
AX := $4400;
BX := TextRec(TextFile).Handle;
MSDos(Regs);
IF (DX AND $80) = 0
THEN IsConsole := FALSE
ELSE IsConsole := ((DX and $02) <> 0) or ((DX and $01) <> 0);
END;
END; { IsConsole within Procss_Command_Line }
<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
internet: donald@cup.portal.com or 72517,3103@compuserve.com