00001 00002 00003 #ifndef BIDIR_PIPE_H 00004 #define BIDIR_PIPE_H 00005 00006 #include <stdio.h> 00007 #include <unistd.h> 00008 00009 struct bidir_pipe { 00010 FILE *read; 00011 FILE *write; 00012 pid_t pid; 00013 00014 bidir_pipe(); 00015 bool open(const char *command, const char *mode); 00016 int close(bool kill_process); 00017 ~bidir_pipe() { close(false); } 00018 }; 00019 00020 #endif 00021