Room_Save Snippet headache

From: Cris Jacobin (jacobin@BELLATLANTIC.NET)
Date: 02/01/98


        I installed the Room_Save snippet tonight, and it appears that the
save_saved function crashes whenever it's called.  The file that is
supposed to contain the objects is created, but empty.

        As my skills are quite weak when it comes to file I/O, any help
would be appreciated.

______Gdb______
(gdb) backtrace
#0  0x4007203b in ?? () from /lib/libc.so.6
#1  0x1770 in ?? ()
#2  0x8071657 in save_saved (i=595) at house.c:692
#3  0x804a3a4 in heartbeat (pulse=6000) at comm.c:740
#4  0x804a26d in game_loop (mother_desc=3) at comm.c:696
#5  0x8049783 in init_game (port=4050) at comm.c:257
#6  0x8049714 in main (argc=3, argv=0xbffffd98) at comm.c:227

______Code_____

void save_saved(int i)
{
  char buf[MAX_STRING_LENGTH];
  FILE *fll;

  if (i == -1)
    return;

   sprintf(buf, "save/%d.save", i);
   fopen(buf, "wb");
   fclose(fll);  <--My guess is the problem lies here, a reference to
                   a file pointer that's never opened.

   fll = fopen(buf, "wb");

   save_save(world[i].contents, fll);

  fclose(fll);
  save_restore_weight(world[i].contents);
}

-jac


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