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