fread stops with eof even if it's not

Hello!

While writing a WAV_Reader I encountered the following problem.

First off a WAV file is opened with fopen, then the cursor is positioned with fsetpos to the appropriate beginning of data. After that now and then some blocks are read from the file with fread, supposedly till there are fewer blocks read then requested. However this happens too soon, without any ferror and with correct feof, even though there is much more data included in the file! The read data is not incorrectly interleaved or something because I redirect the input to the output and it's playing alright, clean and with the correct speed (I also counted the blocks, everything ok, no jumps).

Somehow fread thinks that eof is reached, even though only ca. 5s of 79s data was played. Some theories?
Are you opening the file in binary mode?
In some platforms, files open in text mode are considered to end with certain characters.
Duh...

Just came back to close this issue. Most references on the web don't seem to bother about informing the people about fopen standard opening files in ascii mode. In my opinion it should be the other way around but hey - my problem is solved.

Thanks by the way!
Topic archived. No new replies allowed.