title: Reading WAV header renders wrong data
body: <p>I am trying to read the contents of a WAV file, and to start I want to read the header to find information. According to a lot of sources, the first 44 bytes of the file contain the information.</p>
  
  <p>I have inspected the file with an HEX editor and it contains the correct data, starting with "RIFF", then numbers, "WAVE" and all.</p>
  
  <p>I then tried the following code to access the header values:
  <a href="https://gist.github.com/ranisalt/1b0dbc84ea874a04db3f" rel="nofollow noreferrer">https://gist.github.com/ranisalt/1b0dbc84ea874a04db3f</a></p>
  
  <p>Problem is this renders completely useless information, as if I was trying to read something in the middle of the file. I get nonsense values, not consistent with those from the HEX editor:</p>
  
  <p><img src="https://i.imgur.com/BD6WFzB.png" alt="Imgur"></p>
  
  <p><strong>Please mind</strong> that even though the code is not completely correct, my problem is that the fstream read is not rendering the same bytes the file has.</p>
  
  <p>I also am working on an embedded platform with very little memory, so I need code with minimal overhead, that's why I am not seeking a full fledged library.</p>
  
  <p>I tried seeking to the position 0 of the file before reading, but this is even worse, reading other strange values with no meaning.</p>
  
  <p>What could possibly be happening with the file reading to render such nonsense values?</p>