Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!menudo.uh.edu!svec5 From: svec5@menudo.uh.edu (T.C. Zhao) Newsgroups: comp.unix.programmer Subject: popen ... Message-ID: <1991Jun20.004507.17814@menudo.uh.edu> Date: 20 Jun 91 00:45:07 GMT Sender: svec5@menudo.uh.edu (T.C. Zhao) Organization: University of Houston Lines: 21 I have read the popen man page many times, but still do not quite understand how it should behave. Consider the following code: .... case 4: if(!(fp = popen("more","w")) fp = stdout; lots_of_output_using_fprintf(fp...)_fputs(..,fp)_with_error_check if(fp!=stdout) pclose(fp); break; case 5: everything seems working ok except when more quits prematurely(q), the program exits. I do not think this is the way popen supposed to work, but I would like to make sure.( smell bugs in the program somewhere.) The other question is how to catch the premature exit of more in the program (broken pipe?), checking fprintf return does not seem do the trick. Thanks in advance.