I've a WAVEFORMATEX struct with some codecdata at the end of it (10 bytes).
I'm using C++.
How do I access the data at the end? (this is a purely technical question).
I tried :
WAVEFORMATEX* wav = (WAVEFORMATEX*)pmt->pbFormat;
WORD me = wav->cbSize;
wav = wav + sizeof(WAVEFORMATEX);
BYTE* arr = new BYTE[me];
memcpy(arr, (BYTE*)wav, m开发者_运维问答e);
Didnt work.
Thanks
Roey
You've done a little mistake in pointer arithmetic. After
wav = wav + sizeof(WAVEFORMATEX);
wav points far beyond the end of the buffer (because wav is not CHAR* but WAVEFORMATEX*). You need to write:
wav = wav + 1;
精彩评论