That did it. Thanks! *bonks self* Keith Mervine "Non Omnis Moriar" "Growing old is mandatory, growing up is optional" Service Management Application Developer International Monetary Fund [EMAIL PROTECTED] 202-623-7610
> -----Original Message----- > From: Jef Waite [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 12, 2003 10:10 AM > To: Mervine, Keith > Cc: [email protected] > Subject: Re: Problem with truncating files > > > Mervine, Keith wrote: > > Greetings, > > I have written a small function to list all skills and levels > > the classes receive the skills at in a comma delimited format. > > > > void do_skillcd(CHAR_DATA *ch,char *argument) > > { > > char arg1[MIL]; > > char buf[MSL]; > > int i, sn, skill,class = 0; > > FILE *fp; > > > > fclose( fpReserve ); > > fp = fopen("../data/skillcd.txt", "w" ); > > > > for (sn = 0; sn < MAX_SKILL; sn++) > > { > > sprintf(buf,"%s",skill_table[sn].name); > > fprintf(fp, buf); > > for (i=0; i < MAX_CLASS; i++) > > { > > sprintf(buf,",%d",skill_table[sn].skill_level[i]); > > fprintf(fp, buf); > > } > > sprintf(buf,"\n"); > > fprintf(fp,buf); > > } > > > > send_to_char("Done writing\n\r",ch); > > > You forgot to close your open file pointer..... > fclose( fp ); > > > fpReserve = fopen( NULL_FILE, "r" ); > > return; > > } > > > > > > Is there something wrong with this code? What am I missing? > > fclose also flushes the buffers. Which is most likely your > problem, the > buffers aren't being flushed so the data is hanging in limbo. > You also > are going to create major issues for yourself if you run this program > many times in a row. As each time it will open a new pointer > for file > i/o, and you only have a limited amount per process... > > Fraktyl > > > > >

