Sender: Date: Mon, 19 Dec 1994 17:38:16 +0100 From: "DR. SOLYOM ANDRAS" Reply-To: SOLYOM AT HUBME51 DOT bitnet To: babcock AT cfa DOT harvard DOT edu Cc: DJGPP AT SUN DOT SOE DOT CLARKSON DOT EDU Subject: Re: output redirection in version 2 > I've never seen them in source form A while ago I have sent a little program to this list which redirects stderr to stdin, but it somehow didn't made it. As the question seems to be arise again, I give it another try. So here is the program: **************** ERR2STD.C ********** CUT HERE ***************** #include #include #include main(int argc, char **argv) { int nStdErr; if(argc < 2) { fprintf(stderr, "Error output redirection program for DOS\n" " Usage: %s []\n", argv[0 exit(1); } dup2(fileno(stdout), fileno(stderr)); argc--; argv++; execvp(argv[0], argv); perror(""); return 0; } ************** CUT TILL HERE ************************ This program was compiled by Turbo C++/Borland C++ and was tested to run correctly with GCC. (OK Do not tell me that I have an unused variable nStdErr! FIrst I put some test printout in the program and when I took them out I simply forgot to delete that line...) I hope this helps. Andras