I get an error "Cannot initialize a parameter of type "const unsigned char *" with an rvalue of type 'value_type ' (aka char)" in the following lines.
image->initWithImageData(&(buffer->front()),buffer->size());
buffer is of type std::vector<char> *buffer
and the above error in on &(buffer->front()
does anybody know how to fix it?
The const is not a problem, but you need to cast the pointer - this isn't recommended generally but if you don't have another choice, you can do one of the following
char *a = buffer->data();
const unsigned char *b= reinterpret_cast<unsigned char *>(a);
or plain C style
const unsigned char *b= (const unsigned char *)(a);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With