c - How can I spawn a process and redirect its stdin and stdout? -


i'm writing tiny http server in c , i'm new c programming in linux. implement basic cgi wanto fork server process , execve() cgi script, know how want pass child process urlencoded post data on stdin , retrieve stdout content of process send browser. know has pipe() , dup() or similar can't figure out while reading source code of http server on github:

here c source cgi_child function on line 3330

thank you.