Skip to content

iximiuz/popen2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

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