From: "Maverick" Newsgroups: comp.os.msdos.djgpp Subject: code snippet trouble Lines: 65 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Message-ID: Date: Thu, 24 May 2001 10:49:10 GMT NNTP-Posting-Host: 212.17.127.89 X-Complaints-To: abuse AT news DOT chello DOT at X-Trace: news.chello.at 990701350 212.17.127.89 (Thu, 24 May 2001 12:49:10 MET DST) NNTP-Posting-Date: Thu, 24 May 2001 12:49:10 MET DST Organization: Customers chello Austria To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I have a simple problem (I guess) with my code snippet... it does compile without warnings and errors, it simply hangs my comp (it only accepts the RESET button anymore). I'm almost sure it locks up in the do-while loop and never comes back out (first time I use _dos_findfirst() & _dos_findnext()). Please take a look. void create_new_palette(void) { int z; char fullpath[22]="tiles.bmp\\"; char filename[6]; struct find_t chkfile; FILE *liste, *graphic; set_standard_colors(); <-does nothing right now liste=fopen("tiles.bmp\\chktiles.lst","wb"); if(_dos_findfirst("tiles.bmp\\*dt.bmp", 0, &chkfile)) <- seems to be wrong do { fputc(chkfile.name[0], liste); fputc(chkfile.name[1], liste); fputc(chkfile.name[2], liste); fputc(chkfile.name[3], liste); fputc(chkfile.name[4], liste); fputc(chkfile.name[5], liste); graphic=fopen(chkfile.name, "rb"); fseek(graphic, 54, SEEK_SET); for (z=0; z<255; z++) { Day_Color_Palette[z*3]=fgetc(graphic); Day_Color_Palette[z*3+1]=fgetc(graphic); Day_Color_Palette[z*3+2]=fgetc(graphic); fgetc(graphic); } fclose(graphic); strncpy(filename, chkfile.name, 6); strcat(fullpath, filename); strcat(fullpath, Night_Ending); graphic=fopen(filename, "rb"); fseek(graphic, 54, SEEK_SET); for (z=0; z<255; z++) { Night_Color_Palette[z*3]=fgetc(graphic); Night_Color_Palette[z*3+1]=fgetc(graphic); Night_Color_Palette[z*3+2]=fgetc(graphic); fgetc(graphic); } fclose(graphic); check_palette_entries(); <- Only gives out a text at the moment } while (!_dos_findnext(&chkfile)); <- I guess that's my big error --------- Code below isn't reached and I don't know why ------------------- printf("\n\n %i Colors added to Fake_Palette.", Colors_added); fclose(liste); getch(); } Can anyone tell me what I am doing wrong? Thx, Maverick P.S. : If there's another place for that type of questions please tell me.