Is DWORD FILL only used when passing values in memory?
DWORD FILL adds 2-bytes to the structure when writing to disk.
Without DWORD FILL the records are read correctly by a Visual Basic program using the same structure.
DWORD FILL adds 2-bytes to the structure when writing to disk.
Without DWORD FILL the records are read correctly by a Visual Basic program using the same structure.
Code:
'Records are 203 bytes (if DWORD FILL is added they become 205 bytes) Type ClientType A As Integer '1,2 B As String * 7 '3,7 C As String * 20 '10,20 D As String * 20 '30,20 E As String * 10 '50,10 F As String * 11 '60,11 G As Long '71,4 H As String * 30 '75,30 I As String * 30 '105,30 J As String * 20 '135,20 K As String * 2 '155,2 L As String * 1 '157,1 M Phone As String * 7 '158,7 N As Integer '165,2 O As Long '167,4 P As Long '171,4 Q As Integer '175,2 R As String * 2 '177,2 S As String * 3 '179,3 T As String * 3 '182,3 U As String * 8 '185,8 V As String * 4 '193,4 W As Integer '197,2 X As String * 1 '199,1 Y As String * 4 '200,4 End Type Function PBMAIN() As Long On Error Resume Next Dim hFile As Long, x As Long, sFileName As String, client As ClientType sFileName = "TEST.DAT" hFile = FreeFile Open sFileName For Binary As hFile For x = 1 To LOF(hFile) \ Len(client) Get #hFile, , client Print client.a; client.c Next client.a = x client.c = "Added record" + Str$(x) Put #hFile, , client Print client.a; client.c Close #hFile End Function
Comment