Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top