popen2() - bidirectional popen()
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.md
popen2.c
popen2.h

README.md

popen2 - duplex popen()

Like popen() but returns both child's stdin and stdout.

Usage

#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);
}