473,809 Members | 2,931 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
12 1944
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*******@disc ussions.microso ft.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*******@disc ussions.microso ft.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*******@disc ussions.microso ft.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*******@disc ussions.microso ft.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
108845
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 work fine, but with error reporting at all they are marked as errors. Why? What am I doing wrong? www.monkeyclaus.org
4
2566
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 the name of the 'encoded' output file, and the final filename is an offset file. On a character by character basis, the program needs to look at the first character of the source file and offset it by the first character in the offset file. The...
0
5801
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 ? SELECT ... ; ----> returns 100,000 rows
11
3480
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 tend to iterate over subsets of these arrays by walking a pointer and an offset per dimension across their dimensions. I've found that this tends to result in more performance in a portable manner than doing explicit indexing calculations and...
9
2129
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
3553
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 vector::<bool>::iterator (or reference). However, given a std::vector<bool> a, all a.begin(), a etc are instances of a proxy class so I can not do things like &*a.begin(). Is there a safe way to get the information I need? Many thanks in advance.
1
13056
by: Manish | last post by:
The code is as ... $folderlistfile = $path."xmlfile.xml"; /* <list> <details id="2"> <name>Books</name>
2
1669
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 original line a small amount? Example L-Shaped Line: 1" long 90 degree angle 1"long
8
4002
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' ='~^.~' ); // make sure there is always a match
0
10633
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10375
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10114
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.