I am trying to read two integers, stored consecutively, from a memory block (i have a pointer void *block
pointing to the contents of the block) using memcpy
. The first one is read just fine using:
memcpy(&test, block, sizeof(int));
I try to read the second using:
memcpy(&test, block + sizeof(int), sizeof(int));
(Of course i am having those stataments in different execution instances of the program, so the problem is not that test is being overriden)
but i fail to get the correct result! What am i doing wrong here?