Date: Mon, 9 Feb 1998 20:41:19 -0800 (PST) Message-Id: <199802100441.UAA02901@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: abharmal AT hotmail DOT com (Ali Bharmal), djgpp AT delorie DOT com From: Nate Eldredge Subject: Re: Capturing stdout using system Precedence: bulk At 09:29 2/9/1998 GMT, Ali Bharmal wrote: >I'm writing a SSI wrapper for my web server (its called before a piece of HTML >is delivered, parses it, and runs commands etc.. i.e. dynamic-HTML). One >requirement is that it will run external programs and capture their output and >insert it in place of the command in the HTML e.g. [snipped] >The question is; how do I capture any screen output from these programs? Is >there an alternative to system() which pipes the output into a buffer, or am I >going to have to redirect output to a file which I then read. I'd rather the >former, as I'd like the program to be minimum-impact on the system. I'm not totally sure I understand what you're asking, but see if `popen'/`pclose' do what you want. Note that on DJGPP it will actually be done by redirecting the command and then letting you read its output. There isn't any other solution, AFAIK, on a single-tasking system. Nate Eldredge eldredge AT ap DOT net of programming >without that program becoming Free Software (or Copyleft). Technically true, but it's not quite that cut-and-dried. The standard GPL, which covers most GNU source, forces you to make your code freely distributable with source. The LGPL, or Library GPL, loosens this somewhat: You don't have to make your software freely distributable, but you do have to include source or linkable object code with it. (I think the reasoning is that this way users can update the library to fix bugs.) This is what covers libg++. To confuse the issue further, there is also a "special exception" license, which allows you to do anything you want with the code except pass it off as your own. This applies to things like the Bison parser skeleton. The FAQ and the licenses themselves are the definitive references, of course. Nate Eldredge eldredge AT ap DOT net