Perhaps use the popen() call?