Mail Archives: djgpp/1995/09/04/18:24:31
On 2 Sep 1995, Frederic J. Walter-Scheerer wrote:
> In fact it's only a silly DOS-question, but I think a lot of users of
> djgpp should have the same problem:
> 
> How can I redirect the warnings and errormessages (should be stderr) from 
> djgpp to a file ?
> 
> If it depends on the DOS-version: I'm using MS-DOS 5.0 .
> 
You could always try... THIS:  (It works for me.  It's not 
extra-super-convenient, but it does work.)
#include <stdio.h>
#include <process.h>
#include <dos.h>
 
#define LOTS 1
#define MORE 2
 
void main(int argc, char **argv)
{
        if (argc < 3){
                printf("Usage:  ThisFile.Exe <file> <commandline>\n");
                exit(LOTS);
        }
        if ((freopen(argv[1],"wb",stderr) == NULL))
        {
                printf("Stupid filename.\n");
                exit(MORE);
        }
        execvp(P_WAIT, argv[2], &argv[3]);
/*      spawnvp(P_WAIT, argv[2], &argv[3]); */
/* Spawn fragments memory quite nicely.  Try it sometime. */
}
/***************************************************************
*** Jesse Morris *** enrico AT max DOT tiac DOT net *** jmorris AT ace DOT com ***
***************** Cuthalion / Sliced Bread  *******************/
- Raw text -