[CODE] Crashing

From: peter hartman (wart@KUNTRYNET.COM)
Date: 03/31/98


Hello and Greetings:
  The following code is my do_players code.  What it should do is simply
list off all the player names in the player file.  For some odd reason,
anytime someone does it, it will crash the mud shortly thereafter.  I
haven't been able to figure out a way to get gdb to narrow down the exact
lines that crash it, but I do know when someone calls do_players, then it
will crash.  If anyone has ideas, please let me know.  (Even gdb hints and
tips would be helpful).


  FILE *fl;
  struct char_file_u player;
  int done=FALSE;

  if (!(fl = fopen(PLAYER_FILE, "r+")))
  { send_to_char("Can't open player file.  Uh oh.", ch);
    return;
  }
  sprintf(buf, "Player Name             Player Level\r\n");
  while (!done)
  { fread(&player, sizeof(struct char_file_u), 1, fl);
    if (feof(fl))
    { fclose(fl);
      done = TRUE;
    }
    if (!done)
      sprintf(buf, "%s%-20s %-2i\r\n", buf, player.name, player.level);
  }
  send_to_char(buf, ch);



Wart
mud.kuntrynet.com:4000
http://mud.kuntrynet.com/~wart/mud

"West.  Those who came before me."
 -- Laurie Anderson


     +------------------------------------------------------------+
     | 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