Conversion to const TYPE * const [] problem

Hi guys,
I can't figure this one out, I created an array of FLAC__int32 and I can't pass it to a method of the libFLAC.
1
2
3
4
5
6
7
// Buffer is a vector of BYTES (unsigned chars)
FLAC__int32 * result = new FLAC__int32 [buffer.size()];
// I Convert the vector of BYTES to my raw array
memcpy( result, &buffer.front(), buffer.size() * sizeof (FLAC__int32));
bool ok = false;
// And try encoding
ok = encoder.process(result,need);


I have tried a lot of things, my first use was to inject the vector as a pointer like this
 
&buffer[0]


But the error is the same


error C2664: 'FLAC::Encoder::Stream::process' : cannot convert parameter 1 from 'FLAC__int32 *' to 'const FLAC__int32 *const []'
Last edited on
I solved, the problem is that the function expects an array of pointers, not an array of FLAC__int32

Thus the solution was
1
2
3
4
5
6
7
8
// Buffer is a vector of BYTES (unsigned chars)
FLAC__int32 * result = new FLAC__int32 [buffer.size()];
// I Convert the vector of BYTES to my raw array
memcpy( result, &buffer.front(), buffer.size() * sizeof (FLAC__int32));
bool ok = false;
// And try encoding
ok = encoder.process(&result,need);

Topic archived. No new replies allowed.