我有一个程序“Sample”,它同时从标准输入和非标准文件描述符(3 或 4)获取输入,如下所示
int pfds[2];
pipe(pfds);
printf("%s","\nEnter input for stdin");
read(0, pO, 5);
printf("\nEnter input for fds 3");
read(pfds[0], pX, 5);
printf("\nOutput stout");
write(1, pO, strlen(pO));
printf("\nOutput fd 4");
write(pfds[1], pX, strlen(pX));
现在我有另一个程序“Operator”,它使用 execv 在子进程中执行上述程序(示例)。现在我想要的是通过“Operator”将输入发送到“Sample”。