That's a little pointer arithmetic. Pretend you have something like
char numbers[4];
numbers[0] = 96;
numbers[1] = 97;
numbers[2] = 98;
numbers[3] = 99;
char *pNumber = numbers;
Then *pNumber will equal 96, as you've just referenced numbers[0]. Adding an integer to pNumber and then deferencing allows you to move through the array by incrementing the pointer:
*(pNumber + 1) = 97;
*(pNumber + 2) = 98;
*(pNumber + 3) = 99.
In reality, whenever you reference a certain slot in an array, such as
char string[256];
string[255] = '\0';
what you're really implicitly doing (and what the compiler eventually does) is *(string + 255) = '\0'. The brackets are the more human-readable way of doing things.
Thus, when you have something like
tBasePacket *packet = new tBasePacket;int bytesReceived = 0;while (bytesReceived < sizeof(tBasePacket)) { Receive(packet + bytesReceived, sizeof(tBasePacket) - bytesReceived);}
you're skipping the portion of the packet that's already been received by incrementing the pointer and storing the rest of the incoming data where you left off.
RapscallionGL - arriving soon.
[edited by - johnnie2 on January 8, 2003 9:06:19 PM]
________________________________________________"Optimal decisions, once made, do not need to be changed." - Robert Sedgewick, Algorithms in C