an offset reference to an array?

  • Thread starter Thread starter jamie
  • Start date Start date
J

jamie

I wish to create an array that points to, say, the middle
section of a different array.

eg
Original array >[0] [1] [2] [3] [4] [5] [6] [7]
second array-------------^
[0] [1] [2] [3] [4] [5]

Is this at all possible?? I think that it could be done in
c++, but I dont have a clue as to how to do it in vb.net
if it is even possible.

thanks for all help
 
Why would you want to do this???

Are you wanting an array of arrays or what?
Maybe telling us the application would be helpful....at least a made up
application of what you want to accomplish.

Shane
 
Okay....

I have an array full of data that needs to be parced.
The packets inside the array are all standard, so they
have bytes in piticular areas.
Either I can calculate an offset to that piticular packet,
then the offset to a piticular byte or....

have another array pointing to the beginning of the packet.

I dont know if this makes sence.
(Im a little low on caffeen power.)


-----Original Message-----
Why would you want to do this???

Are you wanting an array of arrays or what?
Maybe telling us the application would be helpful....at least a made up
application of what you want to accomplish.

Shane

I wish to create an array that points to, say, the middle
section of a different array.

eg
Original array >[0] [1] [2] [3] [4] [5] [6] [7]
second array-------------^
[0] [1] [2] [3] [4] [5]

Is this at all possible?? I think that it could be done in
c++, but I dont have a clue as to how to do it in vb.net
if it is even possible.

thanks for all help


.
 
jamie said:
I wish to create an array that points to, say, the middle
section of a different array.

eg
Original array >[0] [1] [2] [3] [4] [5] [6] [7]
second array-------------^
[0] [1] [2] [3] [4] [5]

Is this at all possible?? I think that it could be done in
c++, but I dont have a clue as to how to do it in vb.net
if it is even possible.

thanks for all help

Are you using an ArrayList?

Best Regards,

Andy
 
no, I am not using an array list.
I dont know how much of a speed penilty there would be
by using it.
-----Original Message-----
I wish to create an array that points to, say, the middle
section of a different array.

eg
Original array >[0] [1] [2] [3] [4] [5] [6] [7]
second array-------------^
[0] [1] [2] [3] [4] [5]

Is this at all possible?? I think that it could be done in
c++, but I dont have a clue as to how to do it in vb.net
if it is even possible.

thanks for all help

Are you using an ArrayList?

Best Regards,

Andy


.
 
jamie said:
no, I am not using an array list.
I dont know how much of a speed penilty there would be
by using it.

I suspect there would be far less of a penalty than you might imagine. IME
there is not a perceptible difference, although if you are intensely
processing a couple thousand elements it might matter.

Some of what is happening here is only semantics... Since an array usually
contains more than one of something, I am a bit unclear when you say "array
pointing to the beginning of the packet". To me, that sounds like a simple
variable, not an array.

Are you wanting to treat each element of a string array as if it were itself
an array of characters?

Best Regards,

Andy
 
Unfortunatly I am processing potentialy quite a few
hundred mb (up to one or two gig!) of data, so yes there
could be a major speed penalty at stake.

What I mean is that I am getting data from files and
am putting it in a byte array. I'll scan throught the
byte array and find a marker character. The marker
indicates the beginning of a compleat packet.
If I could have a an array pointing to the beginning
of the new found packet, then I would not have to
calculate the offset from the beginning of the original
byte array.

does this clear things up?
 
Then why not just open the file in binary to read it.

Read until you hit that marker....

Wouldn't that do what you want?

Shane
 
I seam to pay a huge price for doing that. I have improved
the speed of my program one-hundred fold by using
filestream.read(array,offset, bytecount).
I still have one more trick up my sleeve to improve upon
that too.

I was just hoping that there was an even better way.

Thanks anyhow.
jamie.


-----Original Message-----
Then why not just open the file in binary to read it.

Read until you hit that marker....

Wouldn't that do what you want?

Shane
"jamie" <[email protected]> wrote in
message
 

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

Back
Top