Link to home
Start Free TrialLog in
Avatar of pheiss
pheiss

asked on

C Program: Get both stdin and stdout descriptors of sub-process started by a process

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?  
ASKER CERTIFIED SOLUTION
Avatar of cjjclifford
cjjclifford

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Avatar of sunnycoder
sunnycoder
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial