Friday, 7 June 2013

how to get back stdout after piping it with dup?

how to get back stdout after piping it with dup?

int mypipe[2];
pipe(mypipe);
int dupstdout=dup2(mypipe[1],1);
cout<<"hello";//not printed on terminal
fflush(stdout);
now how to print again on terminal or redirect mypipe[0] to stdout?

No comments:

Post a Comment