Re: Add/remove zero index of array
- From: "Ralph" <nt_consulting64@xxxxxxxxx>
- Date: Mon, 24 Dec 2007 11:27:41 -0600
"Tim Rude" <timrude@xxxxxxxxxxxxxxxxxx> wrote in message
news:OhZq6NkRIHA.4880@xxxxxxxxxxxxxxxxxxxxxxx
VB6:or
I've got an array that starts with index 1 [i.e. Dim X(1 to n) as MyUDT
where MyUDT is all fixed length strings].
I need to either add a zero index to this array [X(1 to n) -> X(0 to n)]
*quickly* create a new zero-based array with all of the contents of X plusonly
the new zero index [X(1 to n) -> Y(0 to n)]. I know that ReDim Preserve
works on the top end of the array. I also need to be able to go the otherAccess
way [i.e. X(0 to n) -> X(1 to n) or X(0 to n) -> Y(1 to n), throwing away
X(0)].
Why do I need to do this?
I just discovered that I can read and write an entire UDT array to a disk
file in one fell swoop in Binary mode using Get/Put and it's orders of
magnitude faster than reading/writing one record at a time in Random
mode. However, in the original program I only wrote records X(1 to n) ofthe
array. X(0) never got written since it held some special info that wasThe
internally generated on the fly.
For compatibility purposes, I cannot now include X(0) in the disk file.
file *must* maintain the same format.
So I need to use the 0-based array within the program but read/write a
1-based array to disk.
Rather than make guesses can you show the Binary Get/Put you are currently
using?
Is X(0) always the same length? Or does it have a reliable terminator? Do
the UDTs have a reliable 'begin' marker?
The reason I am asking is because it should be realitively easy to read the
file in one gulp, discard the first part, and then chunk up the rest. This
is done all the time, for example - dbf files.
-ralph
.
- Follow-Ups:
- Re: Add/remove zero index of array
- From: Tim Rude
- Re: Add/remove zero index of array
- References:
- Add/remove zero index of array
- From: Tim Rude
- Add/remove zero index of array
- Prev by Date: Re: Add/remove zero index of array
- Next by Date: Re: Form does not see mouse events!!!!
- Previous by thread: Re: Add/remove zero index of array
- Next by thread: Re: Add/remove zero index of array
- Index(es):
Relevant Pages
|
Loading