Mail Archives: djgpp/1994/09/30/11:16:02

Date: Fri, 30 Sep 1994 07:51:19 -0400 (EDT)
From: Long Doan <ldoan1 AT mason1 DOT gmu DOT edu>
Subject: Re: Rerouting stderr
To: Curtiss Cicco <1CMC3466 AT ibm DOT MtSAC DOT edu>
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu

On Thu, 29 Sep 1994, Curtiss Cicco wrote:

>        Is there a way to reroute the compile error messages I receive on
> my video terminal to a save file instead?

  You can use freopen () to redirect both stdout and stderr to a file:
FILE *logfile;

logfile = freopen ("myfile.log", "w", stdout);
if (!logfile)
  exit (1);
logfile = freopen ("myfile.log", "w+", stderr);
if (!logfile)
  exit (1);

- Raw text -

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