I have a function that return a vector of bytes (unsigned chars). How can I get that data into an array. Apparently the vector is contiguous virtual memory, so that should be easy. I have tried doing this
std::vector<unsigned char> a;
unsigned char* b = &a[0];
but I have not had any luck.
My code looks something like this
// 20 is length of returned vector
const int SOME_LENGTH = 20;
vector<unsigned char> a = get_some_bytes(SOME_LENGTH);
unsigned char b[SOME_LENGTH];
b = &a;
But I am getting this error
error: incompatible types in assignment of ‘std::vector<unsigned char>*’ to ‘unsigned char [20]’