popen() can't tell if cmd fails

Leo de Wit leo at ehviea.ine.philips.nl
Mon Jul 2 18:28:38 AEST 1990


In article <855 at cmsfl> nigel at cmsfl@labtam.oz (Nigel Harwood) writes:
|As a general question, how much use to people make of the popen()
|function in programs where failures must be detected ?
|
|I am working on a program where I would like to use
|popen() but can see no way of detecting when the command exits
|with a bad status.
|
|At least not easily anyway.

>From the popen() manual page:

     A stream opened by popen should be closed by pclose, which
     waits for the associated process to terminate and returns
     the exit status of the command.
 
I guess this says it all ...

    Leo.



More information about the Comp.lang.c mailing list