I have a byte array serialized from a stream char* Buf which points to an array of 64 bytes.
I wish to cast it into a function input parameter Foo(char[4][16] Buf) without copying each and every single bytes.
Any easy for doing so?
I have a byte array serialized from a stream char* Buf which points to an array of 64 bytes.
I wish to cast it into a function input parameter Foo(char[4][16] Buf) without copying each and every single bytes.
Any easy for doing so?
You can cast any buffer to any array you want:
void Foo(char(&buf)[4][16])
{
}
int main()
{
char* buf = new char[64];
Foo((char(&)[4][16])(buf));
delete[] buf;
return 0;
}
I found the answer in link given by Michael Chourdakis
*reinterpret_cast<char(*)[4][16]>(Buf)