[Newbie] scan_file crashes MUD

From: John Woods (JWoodsIII@AOL.COM)
Date: 07/13/98


My MUD got as far as Loading mail system, when it suddenlycrashed. I added
logs in the code to look for the spot where it happened, and finally found my
way into scan_file, in mail.c.

int scan_file(void)
{
  FILE *mail_file;
  header_block_type next_block;
  int total_messages = 0, block_num = 0;
  log("scan_file-- Open mail file");
  if (!(mail_file = fopen(MAIL_FILE, "r"))) {
  log("Mail file non-existant... creating new file.");
  touch(MAIL_FILE);
  return 1;
  }
  log("While");    <------Bootup gets as far as this line, so it must be
while.
  while (fread(&next_block, sizeof(header_block_type), 1, mail_file)) {
    log("If");
    if (next_block.block_type == HEADER_BLOCK) {

... etc ...

I looked for fread, realized that it was a function from one of those #include
<some-system-header>...Couldn't figure out why it was doing this. Anyone have
any clue?
Could it have to do with this?
/* Define if your compiler does not prototype fread().  */
#undef NEED_FREAD_PROTO
I'm using MSVC++ 5.0, Windows95. This started just after I patched in the
regen patch for DG and the abbreviations snippet.

Please flame me, not the list. Sorry I'm a newbie!

-Elrelet


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST