Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!apple!portal!cup.portal.com!Donald From: Donald@cup.portal.com (Donald W Randolph) Newsgroups: comp.lang.pascal Subject: TP test for STDOUT redirection Message-ID: <37964@cup.portal.com> Date: 13 Jan 91 03:58:33 GMT Distribution: usa Organization: The Portal System (TM) Lines: 31 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