tags:

views:

62

answers:

1

Hi All.

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, me);

Didnt work.

Thanks

Roey

+1  A: 

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;
Sergius
Thanks!! You're right.
Roey