Skip to main content
1 vote
Accepted

Lab 4 using feof() function

The problem results from the nuance of the feof() function. The end of file flag isn't set until an attempt is made to read past the last byte of the file. In this case, the prior fread() call will ...
Cliff B's user avatar
  • 69k
1 vote
Accepted

Lab 4 volume understanding fopen() & fwrite()

First, understand the difference between write and append when opening a file for output. If you open a file with "w", or write, it will open the file of the specified name. If it doesn't ...
Cliff B's user avatar
  • 69k
1 vote

Lab4 fread() and fwrite() problem

From man fread On success, fread() and fwrite() return the number of items read or written. This number equals the number of bytes transferred only when size is 1. If an error occurs, or the end of ...
DinoCoderSaurus's user avatar
1 vote
Accepted

Lab 4 - header vs &header

It doesn't matter with arrays. The result will be the same either way. If header had been heap allocated instead, then adding a & would cause a stack corruption, as you'd be passing the address of ...
Fuelled_By_Coffee's user avatar
1 vote
Accepted

unit16_t error while including library

Spelling error in the code. it should be uint8_t not unit8_t
DinoCoderSaurus's user avatar
1 vote
Accepted

Lab 4 problems when the audio is clearly altered

According to the spec: Your program should then read the rest of the data from the WAV file, one 16-bit (2-byte) sample at a time. This program is reading (and writing!) two 2-byte samples at a time....
DinoCoderSaurus's user avatar
1 vote

Why do you not need to allocate memory for int16_t in Lab4, volume?

You are declaring int16_t buffer;. That allocates space on the stack for one 16 bit integer.
curiouskiwi's user avatar
  • 18.7k
1 vote
Accepted

Problems with Lab4

The issue is that you are reading your header in a loop. This action only needs to be done once, which is why the exact size of the header is provided. By reading it in a loop, you are reading through ...
Robert S. Pratt's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible