Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
UDT problems
#21
I need to know because I am using the following method to read/write a fixed length UDT array string to a random record in a file:

Code: (Select All)
' define an array as string.
Type Datatype
  Array As String * 16
End Type
Dim DataRecord As Datatype
Dim Array(8) As Integer
Open "datatest.dat" For Random As #1 Len = Len(DataRecord)
' store array.
For L = 1 To 8
  Array(L) = L
Next
' put array into UDT string.
For L = 1 To 8
  Mid$(DataRecord.Array, (L - 1) * 2 + 1, 2) = MKI$(Array(L))
Next
' put 10 records into file.
For X = 1 To 10
  Put 1, X, DataRecord
Next
' get random record from file.
X = Int(Rnd * 10 + 1)
Get 1, X, DataRecord
' get array from UDT string.
For L = 1 To 8
  M = CVI(Mid$(DataRecord.Array, (L - 1) * 2 + 1, 2))
  Print M;
Next
End
Reply


Messages In This Thread
UDT problems - by eoredson - 11-12-2023, 05:46 AM
RE: UDT problems - by TerryRitchie - 11-12-2023, 05:49 AM
RE: UDT problems - by eoredson - 11-12-2023, 06:05 AM
RE: UDT problems - by mnrvovrfc - 11-12-2023, 06:33 AM
RE: UDT problems - by SpriggsySpriggs - 11-12-2023, 06:19 AM
RE: UDT problems - by eoredson - 11-12-2023, 06:42 AM
RE: UDT problems - by SMcNeill - 11-12-2023, 06:58 AM
RE: UDT problems - by TerryRitchie - 11-12-2023, 06:44 AM
RE: UDT problems - by eoredson - 11-12-2023, 06:50 AM
RE: UDT problems - by TerryRitchie - 11-12-2023, 06:57 AM
RE: UDT problems - by TerryRitchie - 11-12-2023, 06:54 AM
RE: UDT problems - by eoredson - 11-12-2023, 07:02 AM
RE: UDT problems - by eoredson - 11-12-2023, 07:09 AM
RE: UDT problems - by SMcNeill - 11-12-2023, 07:20 AM
RE: UDT problems - by eoredson - 11-12-2023, 07:22 AM
RE: UDT problems - by TerryRitchie - 11-12-2023, 07:25 AM
RE: UDT problems - by SpriggsySpriggs - 11-12-2023, 07:27 AM
RE: UDT problems - by eoredson - 11-12-2023, 07:48 AM
RE: UDT problems - by justsomeguy - 11-12-2023, 11:06 AM
RE: UDT problems - by eoredson - 11-12-2023, 11:41 PM
RE: UDT problems - by eoredson - 11-13-2023, 12:38 AM
RE: UDT problems - by SMcNeill - 11-13-2023, 12:52 AM
RE: UDT problems - by justsomeguy - 11-13-2023, 12:58 AM
RE: UDT problems - by eoredson - 11-13-2023, 01:34 AM
RE: UDT problems - by SMcNeill - 11-13-2023, 02:34 AM
RE: UDT problems - by mnrvovrfc - 11-13-2023, 01:48 AM
RE: UDT problems - by eoredson - 11-13-2023, 01:59 AM
RE: UDT problems - by justsomeguy - 11-13-2023, 02:18 AM
RE: UDT problems - by eoredson - 11-13-2023, 02:26 AM
RE: UDT problems - by eoredson - 11-13-2023, 02:52 AM
RE: UDT problems - by justsomeguy - 11-13-2023, 04:57 AM
RE: UDT problems - by eoredson - 11-13-2023, 05:20 AM



Users browsing this thread: 11 Guest(s)