如何从下面的代码中删除打印的文件名?
else { /* PROCESS D*/
execl("/bin/wc","wc","-l","temp1.txt", NULL);
printf("If this message shows up it's an error on process D");
}
输出为:Found items:7 temp1.text
但我希望它是
找到的项目:7
您传递运行wc的进程的temp1.txt stdin的内容(例如,请参阅execl((似乎没有从stdin读取(,或者您通过shell运行wc,以便使用重定向:
execl("/bin/bash", "bash", "-c", "wc -l < file1.txt > file2.txt", NULL);