How to make this pipe work in c++? -
i programming shell in c++. needs able pipe output 1 thing another. example, in linux, can pipe textfile more doing cat textfile | more
.
my function pipe 1 thing declared this:
void pipeinput(string input, string output);
i send "cat textfile" input, , "more" output.
in c++ examples show how make pipes, fopen() used. send input fopen()
? have seen c++ examples of pipeing using dup2
, without suing dup2
. what's dup2 used for? how know if need use or not?
take @ popen(3), way avoid execvp.
Comments
Post a Comment