QUOTE (NBG @ Jul 16 2006, 18:38)

I load in this 2 files and remove the first 44 bytes (wav-header)
from the 2.wav and append it to 1.wav. Then i write the new
size of the file into the first wav-header (Byte 4). In this case i would
be 299.964 bytes (300.000 bytes - 44 bytes (header of 2.wav) - 8 bytes).
Problem: The new .wav-file only plays the first part (1.wav) and not
the second part after that...
Must i change some things in the subchunks or remove other
tags in the end of both wav-files?
As Andy says, this is easy to do with an audio editor. But if you want to write code to do it, then here's what you need to do:
1. Stripping off the first 44 bytes of file 2 is only correct if you know that there are no additional chunks before the data chunk.
2. The number to be written into bytes 4-7 of the new file (where the first byte is byte 0) is the number of bytes in the file minus 8. The file size field here *excludes* the RIFF header and the file size field itself.
3. You must also rewrite the datalength field. This is typically in bytes 40-43 (but could be elsewhere if there are other chunks - basically it's the last four bytes before the actual audio data begins, and immediately following the "data" chunk descriptor). It should contain the number of bytes of data.
4. If the first file had extra stuff at the end, after the audio data, you'll need to remove that. It's easy to tell if this is the case, by reading the datalength field, working out what file size that would imply, and checking whether the file size is greater than this.
Note: all size fields must be written in Intel format (least significant byte first).