Determine the end of Wav file

Status
Not open for further replies.

Prasad

Newbie level 1
Joined
Dec 13, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,287
How to determine the end of the wav file?
The c function

"while((x=getc(f))!=EOF){}"

is not working for wav files..
 

The BASIC program interfaces I've used typically give a similar example of a command to read all bytes in a file.
DO / UNTIL EOF (or equivalent WHILE/ WEND loop).

At some time I started to find 'EOF' did not always bring about the expected end of a file input loop. I forget if it produced an error, or maybe it simply froze program execution.

Anyway I stopped using 'EOF'. I find it works if I get a byte count of the file length as I open it, and then keep track continually of how many bytes I have read.

Or to read the entire file into memory, and then PEEK each byte in sequence.
 

The .wav file format includes a file-length code in the header.
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…