Article View: comp.sys.sun
Article #6893Re: Problem with system() when using lots of memory
From: Wietse Venema
Date: Thu, 21 Feb 1991 20:15
Date: Thu, 21 Feb 1991 20:15
21 lines
1148 bytes
1148 bytes
In article <1641@brchh104.bnr.ca> david@marshal.gca-prism writes:
>We have been having problems using the system() function with programs
>that are particularly memory hoggish.
Workaround: open a pipe to the shell before your process gets big:
FILE *fp, *popen();
.
.
if ((fp = popen("/bin/sh", "w")) == 0)
oops!
Then write commands to the shell like:
fprintf(fp, "%s\n", whatever...);
fflush(fp);
Don't forget fflush() or things will reach the shell much later than intended.
Wietse Venema
Technical Details
Message-ID:
<1723@brchh104.bnr.ca>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-requestShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!cunews!bnrgate!brtph3!brchh104!brchs1!bnr.ca!rice.edu!sun-spots-request From: wietse@wzv.win.tue.nl (Wietse Venema) Newsgroups: comp.sys.sun Subject: Re: Problem with system() when using lots of memory Keywords: Miscellaneous Message-ID: <1723@brchh104.bnr.ca> Date: 21 Feb 91 20:15:00 GMT Sender: news@brchh104.bnr.ca Organization: Sun-Spots Lines: 21 Approved: Sun-Spots@rice.edu X-Original-Date: Fri, 15 Feb 91 09:31:27 +0100 X-Refs: Original: v10n39 X-Sun-Spots-Digest: Volume 10, Issue 46, message 2 X-Note: Submissions: sun-spots@rice.edu, Admin: sun-spots-request@rice.edu