delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/04/18/04:46:55

From: Thomas Demmer <demmer AT LSTM DOT Ruhr-UNI-Bochum DOT De>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Cannot redirect or pipe console output (printf)
Date: Fri, 17 Apr 1998 20:54:01 +0200
Organization: Lehrstuhl fuer Stroemungsmechanik
Lines: 40
Message-ID: <3537A549.273A5BE1@LSTM.Ruhr-UNI-Bochum.De>
References: <6h7l79$j1o AT bbcnews DOT rd DOT bbc DOT co DOT uk>
NNTP-Posting-Host: bvb.lstm.ruhr-uni-bochum.de
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Richard Russell wrote:
> 
> I'm sure this is an FAQ, but I can't find the answer in the places I have
> looked.  Attempting to redirect the output from printf to a file using '>'
> on the command line, or to pipe it to 'more' with '|', is ineffective.  The
> program originates on a Unix platform (compiled with gcc) and redirection
> and piping work OK there.  However, when compiled for DOS with DJGPP the
> output appears to go to the screen irrespective of the '>' or '|'.
> 
> Richard.
Usually, program output is sent to stdout. That one you can 
redirect with > or |. Diagnostic messages should go to 
stderr, which you can redirect under UNIX with
foo >2 aa , IIRC. 
To do that under COMMAND.COM, you'll need to say
redir -e err.log foo

Unless there is something strange going on in your
program, it should work fine. Check if it does
something like
  fclose(stdout);
  stdout = fopen("/dev/tty","w");
or something else with stdout. 
Without that info it is hard to tell what is going on.


-- 
Ciao
Tom

*************************************************************
* Thomas Demmer                                             *
* Lehrstuhl fuer Stroemungsmechanik                         *
* Ruhr-Uni-Bochum                                           *
* Universitaetsstr. 150                                     *
* D-44780  Bochum                                           *
* Tel: +49 234 700 6434                                     *
* Fax: +49 234 709 4162                                     *
* http://www.lstm.ruhr-uni-bochum.de/~demmer                *
*************************************************************
 altered the 'djgpp.env'
file.  Please check the instructions in chapter 8.1 of the FAQ again,
and if those still don't help, post a system report according to chapter
6.12.

-- 
---------------------------------------------------------------------
|      John M. Aldrich       | "To be 'matter of fact' about the    |
|       aka Fighteer I       | world is to blunder into fantasy--   |
|   mailto:fighteer AT cs DOT com   | and dull fantasy at that, as the real|
| http://www.cs.com/fighteer | world is strange and wonderful." -LL |
---------------------------------------------------------------------

- Raw text -


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