www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/07/03/07:19:09

Message-ID: <BC9127369D17D511B3FB00D0B79134770A8BFC30@snlams200.netherlands.ncr.com>
From: "Allsted, Geir" <ga180600 AT exchange DOT Netherlands DOT NCR DOT COM>
To: "'djgpp AT delorie DOT com'" <djgpp AT delorie DOT com>
Subject: Multiplie Redirections in dos.
Date: Wed, 3 Jul 2002 12:08:22 +0200
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
Reply-To: djgpp AT delorie DOT com

Hi.

I've encountered a problem, that I'm not sure is related to djgpp or windows
itself.
The problem is when you redirect from stdin to stdout several times. I've
been able to narrow it
down to this:

Source:

#include <stdio.h>

int main()
{
  char textline[1024]; 
  while(gets(textline))
  {
        printf(textline); 

  }                      
        fflush (stdout); 
}

Now, the program does nothing of interest, however it will encounter the
problem.


prog.exe < somefile.txt

This works. (Echo's the text)

prog.exe < somefile.txt | prog.exe

This works.

prog.exe < somefile.txt | prog.exe | prog.exe

This works on Win 2k, but hangs on Windows XP

prog.exe < somefile.txt | prog.exe | prog.exe | prog.exe 

This works on Win 2k, but hangs on Windows XP

prog.exe < somefile.txt | prog.exe | prog.exe | prog.exe | prog.exe

Hangs on both win 2k and xp.
For some reason it might work the first the I run the program (the
commandlines), but it will fail the second time.

I'm not even sure the problem is in djgpp, could as well be windows. However
I have not been able to test the program on win9x.

Any help or idea is appreciated.

Geir


- Raw text -


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