Pointer To Byte Array

Discussion to talk about software related topics only.
Post Reply
mjewell
Posts: 7
Joined: Fri Oct 31, 2008 6:45 am

Pointer To Byte Array

Post 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?
User avatar
lgitlitz
Posts: 331
Joined: Wed Apr 23, 2008 11:43 am
Location: San Diego, CA
Contact:

Re: Pointer To Byte Array

Post 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 );
Post Reply