How would I retrieve the stdout error message of a system/shell command?

Justin Whear justin at economicmodeling.com
Thu Sep 8 11:14:40 PDT 2011


For posterity's sake, the "correct" (and much more complicated way) is to 
use pipes and fork(). Here's a Posix-only implementation I wrote a while 
ago: http://pastebin.com/CBYw4fDU

No guarantees on the code, but it demonstrates how to set up the pipes, etc. 
The cool thing is that it supports full two-way communication--the parent 
process can write to the child's stdin and read from both stdout and stderr.

Cheers,
Justin



More information about the Digitalmars-d-learn mailing list