Page 1 of 1

Pointer To Byte Array

Posted: Tue Feb 23, 2010 7:10 pm
by mjewell
I am trying to use "Master_I2CReadBuf" to read 6 bytes into an array of bytes. This function wants a pointer of type PBYTE to specify where to put the data (which I need to point to an array of six BYTE's). I am having trouble with the type agreement when defining the pointer.... any suggestions?

Re: Pointer To Byte Array

Posted: Wed Feb 24, 2010 10:44 am
by lgitlitz
A PBYTE is just a byte pointer (BYTE*). Just define your array that is storing the data and pass in the name of the array. This is straight from the example:
C:\nburn\examples\mod5270\I2C2Serial\main.cpp

//The recieve buffer
BYTE buffer[I2C_MAX_BUF_SIZE];

// Read 30 BYTES from the selected address
I2CReadBuf( address, buffer, 30 );