From: Divisione SINCON Subject: stderr redirection under DOS To: djgpp AT sun DOT soe DOT clarkson DOT edu Date: Thu, 29 Oct 92 20:13:42 MET Mailer: Elm [revision: 66.25] Hello there!, I saw people looking for a way to save the error output messages when compiling I'm currently using this trivial program (Borland C synatx &libs) #include #include #include #include #if !__COMPACT__ #error Must use compact memory model #endif int main(void) { char far *cmd, *t; // Parse command line cmd=MK_FP(_psp,0x81); while ((*cmd==' ') || (*cmd=='\t')) cmd++ ; // skip leading blanks for (t=cmd; *t && *t!='\r'; t++) ; // look for terminating return *t = '\0'; // convert to null dup2(fileno(stdout),fileno(stderr)); return system(cmd); } You use it simply prepending it to the real command and you get stderr and stdout on the sam redirection. something like: errout gcc -c whatever whith options >foo.err will send error messages and normal output to foo.err beware that not always the two files are merged right, so if you send to file the output of a makefile it can happen that the errors come before the line that caused them I haven't found a clen way to overcome this, but I don't think is a real problem. have fun! Mauro Condarelli