My question today is about Qt and the memcpy() function.. I got a QByteArray i_byte_array containing my raw data that I need. First thing I tried is to copy those data in a char* l_array. Which gives me:
void blablafunctionblabla(const QByteArray& i_byte_array)
{
char* l_array = (char*)malloc(i_byte_array.size());
memcpy(l_array, i_byte_array, i_byte_array.size());
// OR: char* l_array = i_byte_array.data(); // same result
}
When I run the code I expected to copy the whole contents of i_byte_array which is: i_byte_array values
As a result I get only this...: l_array value
It seems the copying stopped at the first /0 ignoring the size I request him to copy..
So my questions is Why that happens with memcpy function? And How do I need to proceed in order to copy all raw data? (even /0 which is a useful data for me)