[CODE] fwrite

From: Chuck Reed (creed@I-55.COM)
Date: 02/26/98


Hi there.  I recently wrote a few functions to keep track of the Mud's
year/month/day over the course of rebooting.  I then gave it to another mud
and it is crashing it.  Here is the gdb of the other mud's problem:

#0  0xb8f69 in __sfvwrite ()
#1  0x92418 in fwrite ()
#2  0x2214 in write_mud_date_to_file () at comm.c:686
#3  0x21ab in game_loop (mother_desc=3) at comm.c:673
#4  0x15fe in init_game (port=4000) at comm.c:251
#5  0x1500 in main (argc=2, argv=0xefbfdb80) at comm.c:221
(gdb) frame 2
#2  0x2214 in write_mud_date_to_file () at comm.c:686
686        fwrite(&date,sizeof(struct time_write),1,f)

Here is the function it's crashing on.

void write_mud_date_to_file(void)
{
   FILE *f;
   struct time_write date;

   f = fopen("etc/date_record", "w");
   date.year = time_info.year;
   date.month = time_info.month;
   date.day   = time_info.day;
   fwrite(&date,sizeof(struct time_write),1,f);
   fclose(f);
}

Anyone got a clue about this?

Chuck


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