byte array pointer question

A

andy.dreistadt

Hi all,

I know this is a pretty easy question for most, but I haven't touched
C++ in 5 years and am a bit rusty.

I have the following set-up:

my_function(BYTE *buf,WORD len)
{
//some stuff

int num_bytes = serialSendRcv(0, buf, len, 5000);

//....more stuff
}


The problem is that the first byte of the buf array (buf[0]) is a
filter byte that I no longer need and do not want to pass to the
serialSendRcv() method. Instead, I would like to send it the array
containing buf[1]..buf[len]. I heard the best way to do this is to
dereference the array and increment the address, but I can't remember
how that's done.

Thanks in advance for any help you can give,

Andy
 
V

Victor Bazarov

I know this is a pretty easy question for most, but I haven't touched
C++ in 5 years and am a bit rusty.

I have the following set-up:

my_function(BYTE *buf,WORD len)
{
//some stuff

int num_bytes = serialSendRcv(0, buf, len, 5000);

What you are asking below is

int num_bytes = serialSendRcv(0, buf + 1, len - 1, 5000);

I have no idea what '0' and '5000' are supposed to mean and whether
they need to change as well.
//....more stuff
}


The problem is that the first byte of the buf array (buf[0]) is a
filter byte that I no longer need and do not want to pass to the
serialSendRcv() method. Instead, I would like to send it the array
containing buf[1]..buf[len]. I heard the best way to do this is to
dereference the array and increment the address, but I can't remember
how that's done.

Victor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,197
Messages
2,571,040
Members
47,635
Latest member
SkyePurves

Latest Threads

Top