delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-Spam-Check-By: | sourceware.org |
From: | "Dave Korn" <dave DOT korn AT artimi DOT com> |
To: | <cygwin AT cygwin DOT com> |
References: | <13500536 DOT post AT talk DOT nabble DOT com> <13524102 DOT post AT talk DOT nabble DOT com> <005c01c81c79$d7545d30$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <fgcqid$nj5$1 AT ger DOT gmane DOT org> <008501c81c9f$ffd4c0d0$2e08a8c0 AT CAM DOT ARTIMI DOT COM> |
Subject: | RE: can't read sequential files |
Date: | Thu, 1 Nov 2007 16:38:08 -0000 |
Message-ID: | <009101c81ca5$95db06c0$2e08a8c0@CAM.ARTIMI.COM> |
MIME-Version: | 1.0 |
X-Mailer: | Microsoft Office Outlook 11 |
In-Reply-To: | <008501c81c9f$ffd4c0d0$2e08a8c0@CAM.ARTIMI.COM> |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
On 01 November 2007 15:58, Dave Korn wrote: > On 01 November 2007 15:15, Lewis Hyatt wrote: > > >>>> if (fp==NULL) >>>> { >>>> printf("error, NULL pointer!\n"); >>>> return(1); >>>> } > >> I think what the OP is saying is that if he adds the check for null, >> then his code works normally, including the file read operation, (ie, >> the pointer is not null), but if he removes the check, then he gets a >> segfault. > > > Please observe that the "check for NULL" also includes a return statement > that bypasses the rest of the code .... including in particular the file > read operation. Hang on, I misread you, my eye skipped over the bit where you suggest that adding the check somehow makes the preceding fopen call succeed instead of fail. However I still don't think that's what the OP was saying, unless the subject line of this thread is terribly wrong, I think you just read a bit too much into OP's phrase "everything worked"; I think that just means "program ran to completion /without/ a segfault". cheers, DaveK -- Can't think of a witty .sigline today.... -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |