Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 392 Bytes

README.md

File metadata and controls

23 lines (17 loc) · 392 Bytes

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