Hello,
i am facing some problem with a memcpy.
I have a struct. lets us say
struct
{ unsigned in[6] ; //32 bytes in all
}strb;
struct
{
// FIRST HALF
unsigned int a;
char b[1020];
..
..
//LAST ENTRY
strb a[512]; //512* 32 = 16384 bytes
}A;
Now, ihave a copy of the struct A. Let us call it B.
My goal is to copy all the contents from B to A.
if i do a
memcpy(&A,&B& ,sizeof(A));
// This works perfectly well.
But if i do
memcpy( &A,&B,sizeof(A/2));
memcpy( &A+sizeof(A/2), &B+sizeof(B/2),sizeof(A/2));
the contents are not getiing reflected.
Actually the FIRST HALF of A is 16384 bytes and the LAST ENTRY is 16384. Total size is 32768.
I am not able to find out what the problem is .
Can anyone pls point me to what could be wrong?
Many Thanks.