How to open a process in C++ using popen without directing input and output to stdin? -


i'm developing interactive program takes inputs user (through stdin) , outputs data accordingly (using stdout). while program running need open background application (and leave running while main program running). have done using popen (using "r" mode), @ times stdin conflicts. example when user enters input intended main program, sometimes, program treats input background program. user should never have interact directly background program. there way decouple both input , output of background program stdin , stdout, while still being able read , write using file descriptor background process?

just code need. popen function convenience function can use happens happen need. otherwise, use pipe, fork, dup2, close, , whatever exec-family function want.

you may find helpful @ few implementations of popen/pclose see how work. adjust needed.


Comments