C Program: Get both stdin and stdout descriptors of sub-process started by a process
Posted on 2004-09-06
I have an existing program that uses stdin/stdout to communicate. Let's call it v.exe. I do not have the code, just the executable.
v.exe is an interactive program, so until the stdin received is QUIT, v.exe takes the stdin, does some processing, then writes more data to stdout.
I need to write a new program, called log.exe, that once inititated, calls v.exe.
The program log.exe will display to its stdout the stdout of v.exe.
Similarly, any stdin received by log.exe will be passed to the stdin of v.exe.
If from within log.exe a command like
fd = popen("v.exe", "w");
is used, fd will be the stdout of v.exe. How do I get a file descriptor for stdin of v.exe?