Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!peregrine!elroy!ames!ncar!mailrus!uflorida!novavax!proxftl!bill From: bill@proxftl.UUCP (T. William Wells) Newsgroups: comp.lang.c Subject: Re: Question about popen and pclose Keywords: popen,pclose Message-ID: <577@proxftl.UUCP> Date: 12 Aug 88 12:43:26 GMT Article-I.D.: proxftl.577 References: <364@nynex1.UUCP> Reply-To: bill@proxftl.UUCP (T. William Wells) Organization: Proximity Technology, Ft. Lauderdale Lines: 9 Summary: Expires: Sender: Followup-To: Distribution: In article <364@nynex1.UUCP> tsai@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.