Like popen()
but returns
both child's stdin
and stdout
.
#include"popen2.h"
#include<stdio.h>
int main() {
files_t *fp = popen2("cat");
fputs("foobar\n", fp->in);
fflush(fp->in);
char buf[64] = {};
fgets(buf, 64, fp->out);
printf("%s", buf);
pclose2(fp);
}