|
-
Dec 11th, 2009, 09:25 AM
#1
Re: Help with "Put"ing a UDT
Can you post the file you want to read. It would really help if we could see it.
Are you are Opening the files for Random or Binary?
Are Data and Data2 always the same size or dynamic? If dynamic how does the file indicate the size?
-
Dec 11th, 2009, 10:36 AM
#2
Hyperactive Member
Re: Help with "Put"ing a UDT
How dynamic arrays (and other stuff) are stored is [mostly] explained in the documentation of the Put Statement.
One of the key pieces of information is that saving a dynamic array writes a leading "descriptor" (which requires "2 + 8 * NumberOfDimensions" bytes) before the actual data. The first two bytes of the "descriptor" is the # of dimensions; and for each dimension, the first two bytes of the 8-byte "dimension descriptor" is the number of elements in that dimension. And since you already know the datatype of each element (Integer), you know how many bytes each array element uses (2 for an Integer). But if you didn't know the datatype (or if the datatype were Variant), that info is also stored (I leave it as an exercise for the reader ).
To inspect a file, I'd suggest using a hex editor, such as XVI32. It'll make it easier to verify the contents and validate your understanding.
-
Dec 11th, 2009, 12:56 PM
#3
Thread Starter
Hyperactive Member
Re: Help with "Put"ing a UDT
Ah, the descriptor stuff is what i was looking for! Thanks very much guys.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|