The first problem you have is that you open the WAV file
twice, once in MakeWavFile() and again in PutInWaveRawData(). This is unlikely to work.
The second problem is that you are specifying a WAV file format that is 8-bit integer PCM (sampleBits=8) but you are writing floating point data to the file. You will need to convert the data to the right format before writing it.
I think you need to look at the code a little more closely!
Attached is a DOS utility for analysing the structure of a RIFF file, that might help you in your subsequent development.
Martin.
--
Martin
Certified CVI Developer