当前位置: 技术问答>linux和unix
apue里的P501页的figure 15.6程序怎么运行了没什么输出啊?
来源: 互联网 发布时间:2017-02-15
本文导语: #include #include #define DEF_PAGER "/bin/more" int main(int argc,char * argv[]) { pid_t pid; char * argv0; char * pager; int n; FILE * fp; int fd[2]; char buffer[1024]; if(argc != 2) { printf("usage : ./15.6 pathnamen"); exit(0); } if((fp = fopen(arg...
#include
#include
#define DEF_PAGER "/bin/more"
int main(int argc,char * argv[])
{
pid_t pid;
char * argv0;
char * pager;
int n;
FILE * fp;
int fd[2];
char buffer[1024];
if(argc != 2)
{
printf("usage : ./15.6 pathnamen");
exit(0);
}
if((fp = fopen(argv[1],"r"))==NULL)
{
printf("can't open");
}
if(pipe(fd)