阅读背景:

在C中,如何使用dup2将STDOUT_FILENO重定向到/ dev / null,然后再重定向回原始值?

来源:互联网 

I have an assignment I'm working on and I'm having difficulty finishing it. The idea is to write a program if.c that executes one program and if that succeeds it executes the second program. I'm supposed to suppress the standard output of the first program and unsupress standard output for the second. I'm getting the error message on multiple tests. For instance: "./if echo no then echo yes" returns "echo:write error: Bad file descriptor". I've tried finding what I'm doing wrong online but no luck.I have an assignment I'm working on and I'm hav




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: