By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,534 Members | 910 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,534 IT Pros & Developers. It's quick & easy.

an offset reference to an array?

P: n/a

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
Nov 20 '05 #1
Share this Question
Share on Google+
12 Replies


P: n/a
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

"jamie" <an*******@discussions.microsoft.com> wrote in message
news:6b****************************@phx.gbl...

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

Nov 20 '05 #2

P: n/a
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 upapplication of what you want to accomplish.

Shane

"jamie" <an*******@discussions.microsoft.com> wrote in messagenews:6b****************************@phx.gbl...

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

.

Nov 20 '05 #3

P: n/a
"jamie" <an*******@discussions.microsoft.com> wrote in message
news:6b****************************@phx.gbl...

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
Nov 20 '05 #4

P: n/a
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-----
"jamie" <an*******@discussions.microsoft.com> wrote in messagenews:6b****************************@phx.gbl...

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
.

Nov 20 '05 #5

P: n/a
"jamie" <an*******@discussions.microsoft.com> wrote in message
news:75****************************@phx.gbl...
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
Nov 20 '05 #6

P: n/a
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?
-----Original Message-----
"jamie" <an*******@discussions.microsoft.com> wrote in messagenews:75****************************@phx.gbl...
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. IMEthere is not a perceptible difference, although if you are intenselyprocessing a couple thousand elements it might matter.

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

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

Best Regards,

Andy
.

Nov 20 '05 #7

P: n/a
"jamie" <an*******@discussions.microsoft.com> wrote in message
news:75****************************@phx.gbl...
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
Nov 20 '05 #8

P: n/a
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?
-----Original Message-----
"jamie" <an*******@discussions.microsoft.com> wrote in messagenews:75****************************@phx.gbl...
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. IMEthere is not a perceptible difference, although if you are intenselyprocessing a couple thousand elements it might matter.

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

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

Best Regards,

Andy
.

Nov 20 '05 #9

P: n/a
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" <an*******@discussions.microsoft.com> wrote in message
news:78****************************@phx.gbl...
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?
-----Original Message-----
"jamie" <an*******@discussions.microsoft.com> wrote in

message
news:75****************************@phx.gbl...
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
.

Nov 20 '05 #10

P: n/a
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" <an*******@discussions.microsoft.com> wrote in message
news:78****************************@phx.gbl...
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?
-----Original Message-----
"jamie" <an*******@discussions.microsoft.com> wrote in

message
news:75****************************@phx.gbl...
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
.

Nov 20 '05 #11

P: n/a
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" <an*******@discussions.microsoft.com> wrote in

message

Nov 20 '05 #12

P: n/a
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" <an*******@discussions.microsoft.com> wrote in

message

Nov 20 '05 #13

This discussion thread is closed

Replies have been disabled for this discussion.