> Okay, I feel like such a dumbass now..
> I've been working on a bit of code that automatically ports race and
> class stats to a file for web viewing (something that a newbie can look
> at, before creating a char), and  at the top of the files was :
> fclose( fpReserve );
>
> Once I fixed that, took it out of there, that managed to solve all of
> the copyovr problems at once. Not that I understand the fix 100%, or
> why it was only killing itself randomly, but at least it be fixed ehh?
>

If you reopened the fpReserve file before exiting the function you should
have been ok.

The reason for fpReserve is UNIX usually limits the number of open file
descriptors per process.  The fpReserve is so the game can still save
files.  It closes fpReserve, opens a new descriptor, writes out
information, close the new descriptor, then reopens fpReserve to hold a
slot.  Without fpReserve there is a possibility that the mud process could
open up all available descriptors and never be able to save pfiles.

It's usually a good idea to do the fclose(fpReserve) before writing, then
reopen it, at least then you are fairly sure to write the data you want.

Jef



Reply via email to