I don't follow your code completely but it looks like you are incorrectly doing pointer arithmetic. The short answer is that you need to do some casting to calculate offsets in bytes.
Consider the code:
char* ch = new char[20];
char* pch = ch + 1;
int* in = new int[20];
int* pin = in + 1;
Note that pch points 1 byte past 'ch', but (surprise!) pin points 4 bytes (sizeof(int)) past 'in'. When you add an integer to a pointer of type 'x', the result is the pointer plus the integer times sizeof(x). It is not pointer plus integer.
You probably want to cast the pointers in your code to be 1 byte fields (ie. char* or equivalent)...