473,326 Members | 2,108 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

an offset reference to an array?


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
12 1919
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
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
"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
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
"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
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
"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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: lawrence | last post by:
I just switched error_reporting to ALL so I could debug my site. I got a huge page full of errors. One of the most common was that in my arrays I'm using undefined offsets and indexes. These still...
4
by: Gactimus | last post by:
Here is a program that encodes and decodes a text file. What I need to do is write a C++ program that requests 3 different file names. One filename is for the source file to be encoded, another is...
0
by: D. Dante Lorenso | last post by:
I need to know that original number of rows that WOULD have been returned by a SELECT statement if the LIMIT / OFFSET where not present in the statement. Is there a way to get this data from PG ?...
11
by: Bradford Chamberlain | last post by:
I work a lot with multidimensional arrays of dynamic size in C, implementing them using a single-dimensional C array and the appropriate multipliers and offsets to index into it appropriately. I...
9
by: bahadir.balban | last post by:
Hi, When you define an array base with a define statement, like #define ARRAY_BASE 0x1000; and access it, such as ARRAY_BASE
8
by: Bo Peng | last post by:
Dear list, I am using std::vector<bool> (bit_vector) to store my bit sequence. To access the same sequence from C (to expose to a python module), I need to know the pointer and offset of...
1
by: Manish | last post by:
The code is as ... $folderlistfile = $path."xmlfile.xml"; /* <list> <details id="2"> <name>Books</name>
2
by: Mel | last post by:
This is a long shot but here goes... I have a line that may have several bends (angles) to it. Anyone know of any tips or tricks to create the same line again but just have it offset from the...
8
by: Thomas Mlynarczyk | last post by:
Hello, I want to split a given string into tokens which are defined by regexes: // example tokens - a bit more complex in real $tokens = array( 'NUMBER' ='~^\d+~', 'NAME' ='~^+~', 'ANY' ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
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...
1
isladogs
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
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...
1
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)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.