did the fopen actually work? you need to check it. does the file exist? if((f=fopen("etc/date_record","w"))==NULL) { log(error_message); return; } look up the 10 commandments of C programming on the web. you broke #6: If a function be advertised to return an error code in the event of difficulties, thou SHALT check for that code, yes, even though the checks triple the size of thy code and produce aches in thy typing fingers, for if thou thinkest "it cannot happen to me", the gods shall surely punish thee for thy arrogance. also, that them check the output of the limit command and make sure they type unlimit before running the mud. congrats on providing ample material to be offered help. --Angus ______________________________ Forward Header __________________________________ Subject: [CODE] fwrite Author: INTERNET:CIRCLE@POST.QUEENSU.CA at CSERVE Date: 2/26/98 6:49 PM 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