Re: Segmentation fault

From: Mike Breuer (mbreuer@new.rr.com)
Date: 09/14/01


----- Original Message -----
From: "flawed" <flawed@IO.COM>


> I went around and looked just to see, and it does appear correct that if
> the fclose(player_fl); in comm.c did in fact cause the seg fault.

If it's crashing on that line, I suspect you either have ASCII files
implemented, or you are calling fclose(player_fl) somewhere else.

If you're using binary files (i.e., you haven't patched in ASCII files), try
checking to see if you are closing the player file somewhere else:
grep -ne "fclose(player_fl)" *.c

> If someone could though, explain the possible dangers of removing that,
> or not replacing it with something else... is that fine to do?

Assuming you are using normal binary player files, you should have that in
so that the file is properly closed when you shut down.  If you take the
line out, most operating systems will go ahead and close any open file
handles when your process terminates, so you wouldn't technically be
breaking anything.  However, it is considered good practice to close your
file handles explicitly when you are finished with them.

Mike

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/06/01 PST