in reply to feeding info to C programs....

Abigail-II has provided an execellent answer (node 304670) to a similar problem in the answer to "passing string to stdin on exec-command". I think this is probably what you are looking for.