From: abharmal AT hotmail DOT com (Ali Bharmal) Newsgroups: comp.os.msdos.djgpp Subject: Capturing stdout using system Date: Mon, 09 Feb 1998 21:29:52 GMT Organization: Selwyn College, The University of Cambridge Lines: 28 Message-ID: <6bnsgl$p2u$1@lyra.csx.cam.ac.uk> NNTP-Posting-Host: quango.sel.cam.ac.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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. Welcome to turns into: Welcome to quango.sel.cam.ac.uk where gethostname (an executable) outputs 'quango.sel.cam.ac.uk'. 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 know this can be easily done in perl ala "$output=`gethostname`" which would run the command and stick it's output into $output, is there a C++/DJGPP 'way' of doing this?] -- _ |. |_ |_ _ _ _ _ _ | Selwyn College, Cambridge CB3 9DQ (_||| |_)| |(_|| `| | |(_|| http://quango.sel.cam.ac.uk/ "Little science leads away from God. Much science leads to God" - Leibnitz