The statement
while (((!feof(DS) && (curPos<seek_end))));>
is in the wrong place. It is at the end of an
if
clause, rather than the
do
clause which starts at line 65. Something that you could easily spot for yourself if you had used proper indentation on your code.
Also note that your declaration of
buf
is still one element short.
Also using the name
buf
for an array, and
BUF
for a character variable is not the most sensible choice of names.