Message-ID: <36615BB8.7FCDE53F@gmx.de> Date: Sun, 29 Nov 1998 15:35:36 +0100 From: Christian Hofrichter X-Mailer: Mozilla 4.07 [de]C-QXW0310J (Win95; I) MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: problem with fseek and/or feof Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com I have a problem with "feof" and "fseek". What I did, was the following. #include #include void main(void) { FILE *f; clrscr(); f=fopen("binary_file","rb"); /*open files in binary-mode for reading */ if (f==NULL) /* check if file exists; if not print error-message and exit */ { printf("Error !\n"); getch(); exit(1); } while(feof(f)==0) { fseek(f,1,SEEK_CUR); } fclose(f); } This program should increase the filepointer by one byte, everytime the loop is executed until EOF is reached. "feof" return 0 if the EOF is not reached. Otherwise it returns a value, different from 0. So the loop should be executed until "feof" says that EOF is reached, shouldn't it ? But it doesn't. The loop isn't aborted and has no end.