Easy enough to write one's own with a call to pipe(2) and some sleight-of-handle with dup2 and friends, depending on need. Stevens' "Adv. Prog. in the Unix Env." has the canonical examples. Offhand, though, I can't think of an existing library routine. The OP is not so hot on C programming, he says. (I refer him to the book just mentioned, which is truly "how to write real Unix programs", should he like to improve his skills at the feet of a master.)
I actually *just* received that book a couple days ago from amazon. I've barely made it through the preface, but I can already tell that this book will enable me to be mediocre :-) --Bryan