a=daveGetU16(dc);
b=daveGetU16(dc);
printf("DB1: DW0: %d\n",a);
printf("DB1: DW1: %d\n\n",b);
a=daveGetU
16(dc); // This uses two bytes from the bufffer and hence advances the buffer pointer by 2 bytes;
// So here the buffer pointer points at what is the copy of DW2
b=daveGetU
16(dc); // therefore, b is DW2
printf("DB1: DW0: %d\n",a);
// and printf("DB1: DW1: %d\n\n",b); should be
printf("DB1: DW2: %d\n\n",b);
Maybe this example can help:
davereadBytes(dc,daveDB,1,0,100,NULL); // read more bytes than we might ever use...
// After this, the buffer pointer points to start of our buffer. There begins a copy of DW0 or DBD 0 or DBB0.
a=daveGetU
32(dc);
// After this, the buffer pointer points to the 5th of our buffer. This is where copies of DW4 or DBD4 or DBB4 begin.
b=daveGetU
16(dc); // fetches a copy of DBW4
// After this, the buffer pointer points to the 7th of our buffer. This is where copies of DW6 or DBD6 or DBB6 begin.
b=daveGetU
8(dc); // fetches a copy of DBB6
// After this, the buffer pointer points to the 8th of our buffer. This is where copies of DW7 or DBD7 or DBB7 begin.
a=daveGetU
32(dc); // fetches a copy of DBD7
// After this, the buffer pointer points at the 13th byte in buffer, which is the start of the copy of DW11 ( or DBB11, or DBD11)
Another example, now reading from a different address:
davereadBytes(dc,daveDB,1,117,100,NULL); // read more bytes than we might ever use...
// After this, the buffer pointer points to start of our buffer. There begins a copy of DW117 or DBD 117 or DBB117.
a=daveGetU
32(dc);
// After this, the buffer pointer points to the 5th of our buffer. This is where copies of DW121 or DBD121 or DBB121 begin.
b=daveGetU
16(dc); // fetches a copy of DBW121
// After this, the buffer pointer points to the 7th of our buffer. This is where copies of DW123 or DBD123 or DBB123 begin.
b=daveGetU
8(dc); // fetches a copy of DBB123
// After this, the buffer pointer points to the 8th of our buffer. This is where copies of DW124 or DBD124 or DBB124 begin.
a=daveGetU
32(dc); // fetches a copy of DBD124
// After this, the buffer pointer points at the 13th byte in buffer, which is the start of the copy of DW128 ( or DBB128, or DBD128)