Does this source code help you much with that? It only deals with wave files but can read / write 8, 16, 24 or 32 bit wave files, at whatever sample rate, with however many channels.
I really wish someone would make a header only C++ audio library, that would be soooo nice.