Hi, I tried to do it in C, however I found it too difficult, I ended up trying to create child processes for each execution of file and feed results to parent. I attempted to keep the entire program in C, but it ended up becoming too time consuming & I'm always using freeBSD, so portability doesn't bother me. Even windoze users can install a UNIX type shell on there system, so I guess this works for all anyway.
But in the end I did the most simplest thing possible, and use the OS's functions instead of C, and it's more efficient as well :P