[comp.sys.ibm.pc] redirecting stderr to stdout

sanjay@hi3.ACA.MCC.COM (Sanjay Keshava) (06/01/90)

Hi folks.

I'm using the Intek C++ compiler on a 386 PC running DOS 4.0.

This compiler outputs its  error messages to stderr,  so I cannot  use
the redirection character ">" at the command level  to save the output
in a file.

Does anyone have a  hack that will  modify DOS to  overlap stderr onto
stdout?

I  tried writing a   short assembly program   that uses  DOS  INT 21H,
function 46H (CDUP) to force stderr to output to stdout, but it didn't
work.   I'm not  very knowledgable  with  the DOS interrupts,  so   my
understanding of CDUP's operation may be wrong.

I  also  retrieved REDIRECT.C from Simtel20,   but it didn't  solve my
problem.   In fact it  causes a  stack   overflow error.  Part of  the
problem might stem from the compiler  switching the 386 into protected
mode to take advantage of  extended  memory and then switching back to
real mode when it's done.

Thanks in advance for any help.

-- 

                                             Sanjay
                                             ->|<-
                                     sanjay@hi3.aca.mcc.com

bressler@iftccu.ca.boeing.com (Rick Bressler) (06/02/90)

As far as I know, dos (the command.com shell acutally) does not allow 
redirecting standard error.  Two solutions occur to me. 4dos, (an improved 
shell) will run under dos 4.0 I believe, and it allows separate   
re-direction of stdout, plus many other goodies. I recommend it.  A dos
solution might be to write a small c program that re-opens standard error to 
a file and then spawns your process.  I can't say for your particular case, 
but I have in the past used this method with success.

Rick

kdq@demott.COM (Kevin D. Quitt) (06/03/90)

    Part of Microsoft C 5.x is a program called ERROUT which does the
redirection of errout to any other channel.  It's not bundled with 6.0
-- 
 _
Kevin D. Quitt         Manager, Software Development    34 12 N  118 27 W
DeMott Electronics Co. 14707 Keswick St.   Van Nuys, CA 91405-1266
VOICE (818) 988-4975   FAX (818) 997-1190  
MODEM (818) 997-4496 Telebit PEP last      demott!kdq   kdq@demott.com

      96.37% of the statistics used in arguments are made up.