delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/11/02/18:35:41

From: nospam AT nospam DOT net (Brian Chapman)
Newsgroups: comp.os.msdos.djgpp
Subject: Question on process piping, redirection, etc... in C
Message-ID: <MPG.1289249230e22063989684@news.southwind.net>
X-Newsreader: MicroPlanet Gravity v2.10
Lines: 16
NNTP-Posting-Host: 206.252.189.6
X-Trace: typ11.nn.bcandid.com 941582274 206.252.189.6 (Tue, 02 Nov 1999 17:37:54 EST)
NNTP-Posting-Date: Tue, 02 Nov 1999 17:37:54 EST
Organization: bCandid - Powering the world's discussions - http://bCandid.com
Date: Tue, 2 Nov 1999 16:42:33 -0600
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

if i have a funtion (eg: parse_file(FILE *f)) and i want to read the 
output (eg: stdout) of another program that is ran via one of the spawn() 
functions, how could i redirect the spawned process's stdout to be a file 
stream for the parse_file() function?

in other words, i would like to do something much cleaner than the 
following:

system("program.exe -args  > datafile.tmp");
f=fopen("datafile.tmp","rt");
if (!f) do_error();
parse_file(f);
close(f);


thanks much in advance!!

- Raw text -


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