Re: Re: Reading UDTs out of a byte array (CopyMemory vs Get on a disk file)
From: Beowulf (beowulf_is_not_here_at_hotmail.com)
Date: 06/18/04
- Next message: Gale Green: "Re: Reading UDTs out of a byte array (CopyMemory vs Get on a disk file)"
- Previous message: Gale Green: "Re: Reading UDTs out of a byte array (CopyMemory vs Get on a disk file)"
- In reply to: Gale Green: "Re: Reading UDTs out of a byte array (CopyMemory vs Get on a disk file)"
- Next in thread: Gale Green: "Re: Reading UDTs out of a byte array (CopyMemory vs Get on a disk file)"
- Reply: Gale Green: "Re: Reading UDTs out of a byte array (CopyMemory vs Get on a disk file)"
- Reply: Gale Green: "Re: Reading UDTs out of a byte array (CopyMemory vs Get on a disk file)"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 18 Jun 2004 15:00:41 -0400
On Fri, 18 Jun 2004 19:48:46 +0100, Gale Green
<gale@databeat.fsnet.co.uk> ejaculated:
>On Fri, 18 Jun 2004 14:26:17 -0400, Beowulf
><beowulf_is_not_here@hotmail.com> wrote:
>
>> Ok, I've been banging my head against the wall on this one for the
>> better part of a day, now and am hoping someone can point me in the
>> right direction.
>
>That's a lot of code to plough through. <g>
Sorry. :( I'll appreciate any comments
>I don't think you show what values are in the record size constants
>(e.g., VAX_DBSV_REC_SIZE), but do remember that VB strings are Unicode
>so, "String * 6" means 12 bytes.
VAX_TSTAMP_REC_SIZE = 64
VAX_DBSV_REC_SIZE = 128
>If a UDT contains just two String * 6 members then you have to
>CopyMemory 24 bytes from your file buffer.
That thought had occurred to me, but when I altered the values of
these constants to account for Unicode, then I could not read the
header record correctly and reading the "variable records" was even
more messed up than it is now. If I read VAX_DBSV_REC_SIZE bytes out
of my byte array with CopyMemory, the first several fields are all
correct, including fields that come after dbsv_seg_var_name. The
misalignment occurs within the UDT. However, the next UDT gets read
out of the byte array starting at the right spot. It's because of
this that I suspect the issue has to do with how VB aligns or pads
data within UDTs.
Also, I forgot to include the declaration for data_base_seg_vars in my
original message. So, some more code is included below. Thanks.
Public Type data_base_seg_vars
dbsv_left_ptr_offset As Long ' Offset value for next
left pointer
dbsv_right_ptr_offset As Long ' Offset value for the
next right pointer
dbsv_balancing_byte As Byte ' Binary tree routine
balancing byte
dbsv_unique_variable As String * 1 ' "U" = unique def. of
var, "M" = appears on other segs
dbsv_seg_var_name As String * 16 ' Segment.variable name
without the "."
dbsv_offset_value As Integer ' Equal to
occurence_number
dbsv_var_attribute As Byte ' "C" = char, "N" =
numeric, "D" = date, "P" = phone
dbsv_var_status As Byte ' "A" = active, "D" =
deleted
dbsv_format_offset_h As Long ' Offset value for
pointer into hard format table
' crap as integer - offset 34
dbsv_format_offset_s As Long ' Offset value for
pointer into soft format table
dbsv_segment_offset As Long ' Offset value for
pointer into segment table
dbsv_var_offset As Integer ' Offset value for
pointer into variable addr in segment
dbsv_lo_bound As Integer ' Low bound dimension of
array
' crap as integer - offset 46
dbsv_hi_bound As Integer ' High bound dimension
of array
dbsv_var_length As Integer ' Length of variable as
defined in data dictionary
dbsv_var_new_length As Integer ' Corrected length to
replace current length after DD is reorged
' crap as byte - offset 54
dbsv_redefine_begin As Integer ' For overlay vars only,
dbsv_offset_value of 1st redefined var
dbsv_default_missing_values As String * 4 ' Missing value offset
size
dbsv_order_number As Integer ' Allows listing vars in
an order different from occnum or alpha
' crap as integer - offset 64
dbsv_var_label As String * 40 ' Variable label
dbsv_digits_only As Byte ' "D" = digits only for
a char var, " " = otherwise
dbsv_response_require As Byte ' "R" = response
required for char var instead of formats, " " = otherwise
dbsv_question_number As String * 5 ' Questionnaire number
for this variable
dbsv_available_byte As Byte ' Unused
dbsv_order_number_ptr As Long ' Ptr to order number
node (ord_num_node)
dbsv_new_format_offset_h As Long ' If length changes,
this points to future hard format
dbsv_new_format_offset_s As Long ' If length changes,
this points to future soft format
dbsv_delivery_flag As Byte ' " " = var will be
delivered, "N" = NOT delivered
dbsv_redefine_end As Integer ' For overlay vars only,
dbsv_offset_value of last redefined var
dbsv_next_var_num As Integer ' Position of next var
(for traversing seg by order num)
dbsv_filler_1 As Byte
End Type
-- What do you get when you multiply 6 by 9?
- Next message: Gale Green: "Re: Reading UDTs out of a byte array (CopyMemory vs Get on a disk file)"
- Previous message: Gale Green: "Re: Reading UDTs out of a byte array (CopyMemory vs Get on a disk file)"
- In reply to: Gale Green: "Re: Reading UDTs out of a byte array (CopyMemory vs Get on a disk file)"
- Next in thread: Gale Green: "Re: Reading UDTs out of a byte array (CopyMemory vs Get on a disk file)"
- Reply: Gale Green: "Re: Reading UDTs out of a byte array (CopyMemory vs Get on a disk file)"
- Reply: Gale Green: "Re: Reading UDTs out of a byte array (CopyMemory vs Get on a disk file)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|