阅读背景:

在C中,当执行execvp()或类似的调用时,如何将stdin/stdout/stderr重定向到文件?

来源:互联网 

I have the following code:

我有以下代码:

pid_t pid = fork();
if (pid == -1)
{
    // ...
}
else if (pid == 0)
{
    stdin = someopenfile;
    stdout = someotherfile;
    stderr = somethirdopenfile;
    execvp(args[0], args);
    // handle error ...
}
else
{
    // ...
}
pid_t pi



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

分享到: