我正在尝试将文件用作程序的输入和输出,但是不起作用-输出文件为空
int in = open(configuration->inPath, O_RDONLY);
int out = open(outPutFile, O_WRONLY | O_TRUNC | O_CREAT, S_IRUSR| S_IRGRP | S_IWGRP | S_IWUSR);
pid_t child = fork();
if(child == 0) {
dup2(in, STDIN_FILENO);
close(in);
dup2(out, STDOUT_FILENO);
close(out);
execvp(execFile, NULL);
exit(0);
}
execFile正在工作。你有什么主意吗?
谢谢!