www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/09/04/18:24:31

Date: Mon, 4 Sep 1995 00:44:43 -0400 (EDT)
From: Cuthalion / Sliced Bread <enrico AT max DOT tiac DOT net>
To: DJGPP Listserver <djgpp AT sun DOT soe DOT clarkson DOT edu>
Subject: Re: Redirecting compileroutput to file

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 -


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