Here's a moderately complicated one :
http://momonga.t.u-tokyo.ac.jp/~ooura/fft.htmlYou will have to save the wav file as "raw audio" with a wav editor. The wav editor will ask you what byte order you want. The result will be a file with 4 bytes per sample. Two for the left channel value and 2 for the right channel value. Then you can process it with the above code.
You will have to choose a size. Usually, 4096 samples are converted at once. You might use an overlap : process from 1 to 4096, from 2049 to 6144 etc, and you can use a windowing function too : multiplying the 4096 samples by a Hanning (accurate frequency peaks) or Blackman-Harris (low noise) function.
It's very useful to play with the spectrum analyzer of an audio editor, and it's settings, in order to understand how those parameters work.