popen gives you one or the other: not both. That's because standard POSIX pipes are half-duplex only. You might consider socketpair, fork, dup2, fdopen, and system. "rw" is probably just a Solaris extension, but I don't think it's standard.
ta0kira
PS I'm sure it wouldn't be much trouble to hack libc and steal the popen function to make your own full-duplex version. Just copy the function, name it something else, add the "rw" argument, use socketpair instead of pipe when "rw" is used, then dup2 to both standard input and output instead of just one. I'll take a look later and see if I can come up with an example.
Last edited by ta0kira; 03-07-2008 at 10:39 AM.
|