delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/11/19/00:33:55

Date: Fri, 18 Nov 1994 17:41:15 +0100
From: solyom AT falcon DOT fat DOT bme DOT hu
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Rerouting stderr

This subject is mentioned so many times over the last few months that I thought
someone must do something about it. Actually there are programs with which you
can re-route stderr. I have an 'ERROUT.EXE' program which came together with
Microsoft C 5.0. I would recommend it to anyone. The problem is of course, that
I do not know wether it is allowed to distribute it or not. So I wrote the 
following little proggy, that tries to redirect stderr. I compiled it with
Borland C++ 3.1 and it worked with EXE and COM files. 
As I did not test it with DJGPP's make ( I personally use the real mode
'MAKER.EXE' from Borland) I do not know wether it works with that too or not.
I was able to compile a fairly big project with it using the command line
	ERR2STD MAKER -f MyProject.mak
I hope it helps.

--------- CUT HERE ---------
#include <stdio.h>
#include <io.h>
#include <process.h>

main(int argc, char **argv)
{
        int nStdErr;

        if(argc < 2)
        {
                fprintf(stderr, "Error output redirection program for DOS\n"
                        " Usage: %s <executable name> [<parameters>]\n", argv[0
);
                exit(1);
        }

        dup2(fileno(stdout), fileno(stderr));
        argc--;
        argv++;

        execvp(argv[0], argv);
        perror("");
        return 0;
}    
------ END OF 'ERR2STD.C ----------

			Andras

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019