Question about popen and pclose

T. William Wells bill at proxftl.UUCP
Fri Aug 12 22:43:26 AEST 1988


In article <364 at nynex1.UUCP> tsai at nynex1.UUCP (Nelson Tsai) writes:
: Then, after executed about 20 times, it caused segmentation fault
: (core dumped).  Why is that ?  Why reading from the pipe cause the
: segmentation fault ?

That's an easy one.  You ran out of fd's and the popen call
failed.  It returned a null pointer and fgets tried to
dereference it.  Thus the core dump.  When you didn't include the
fgets, the pointer was never dereferenced, hence no core dump.



More information about the Comp.lang.c mailing list