Article View: comp.os.msdos.programmer
Article #5605Re: Spawning processes in DOS
From: DJ Delorie
Date: Wed, 03 Apr 1991 22:22
Date: Wed, 03 Apr 1991 22:22
19 lines
1088 bytes
1088 bytes
In article <1991Apr3.133226.22304@ibmpa.awdpa.ibm.com> dougs@claude1.rchland.ibm.com (J Doug Smith) writes:
> I'm trying to write an application that will run another program and
> get that program's output so it can be displayed to the user (much
> like an editor runs a compiler and sends the compiler's output to the
> user). Does anyone have any Ideas on how to accomplish this? Execing
> another programs certainly is no problem, I just don't see how to get
> the output from that program.
The only safe way (ie: compatible) is:
. . .
rc = system("cc -c foo.c > /tmp/blat 2>&1");
rf = fopen("/tmp/blat", "r");
. . .
but watch out for the 2>&1 on DOS :-)
DJ
dj@ctron.com
Technical Details
Message-ID:
<1374@bragi.ctron.com>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!balrog!djReferences:
<1991Apr3.133226.22304@ibmpa.awdpa.ibm.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!samsung!balrog!dj From: dj@balrog.ctron.com (DJ Delorie) Newsgroups: comp.os.msdos.programmer Subject: Re: Spawning processes in DOS Message-ID: <1374@bragi.ctron.com> Date: 3 Apr 91 22:22:33 GMT References: <1991Apr3.133226.22304@ibmpa.awdpa.ibm.com> Organization: None whatsoever Lines: 19