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 2 3178 an************@gmail.com wrote: 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
Victor,
It worked! Thanks again for your help.
Andy This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Harry Overs |
last post by:
My program needs to take a pointer to BYTE array (unsigned char*) and
convert it into a STL list so that each BYTE in the array has its own
element in the list, i.e. if the array has hundred bytes...
|
by: Ray Z |
last post by:
So far, I get the idea that if I want to use both the unmanaged and managed
memory, I can not avoid memory copy. But I DO need to avoid it. I get a idea
that maybe I could use "union" to convert...
|
by: intrepid_dw |
last post by:
Hello, all.
I've created a C# dll that contains, among other things, two functions
dealing with byte arrays. The first is a function that returns a byte
array, and the other is intended to...
|
by: Fireangel |
last post by:
I want to cast a class into a byte array. I've seen some examples of this
floating around, but they all have simple data members. What happens if I
cast something that has a ArrayList or an...
|
by: Brian Black |
last post by:
Hi,
Sorry For the Cross Posting But, I just started programming .net and
i have a question. I have a byte array of 14 bytes (CODE BELOW), i
need to copy the data from the the byte array into...
|
by: quantumred |
last post by:
I found the following code floating around somewhere and I'd like to
get some comments.
unsigned char a1= { 5,10,15,20};
unsigned char a2= { 25,30,35,40};
*(unsigned int *)a1=*(unsigned int...
|
by: ThunderMusic |
last post by:
Hi,
The subject says it all... I want to use a byte and use it as byte* so I
can increment the pointer to iterate through it.
What is the fastest way of doing so in C#?
Thanks
ThunderMusic
|
by: borophyll |
last post by:
As I read it, C99 states that a byte is an:
"addressable unit of data storage large enough to hold any member of
the basic character
set of the execution environment" (3.6)
and that a byte...
|
by: Scott Townsend |
last post by:
So I need to talk to a devices that expects all of the bits and bytes I sent
it to be in specific places (not yet 100% defined).
I wanted to create a structure/class with all of the data in it...
|
by: O.B. |
last post by:
When using Marshal to copy data from a byte array to the structure
below, only the first byte of the "other" array is getting copied from
the original byte array. What do I need to specify to get...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |