Again inspired by conversation on Discord, this is something I did in 90's with old QB but never got around to testing with QB64 until now:
_Title "UDT to Random Access File Test" ' b+ 2021-12-24
Const SW
= 1000, SH
= 700
'testing the FakeText$ function because RA is very strict on fixed strings!
TheItem(1).Text = FakeText$(255)
TheItem(1).FileName = FakeText$(255)
Print TheItem
(1).FileName
'make fake data to file
TheItem(i).Text = FakeText$(255)
TheItem
(i
).SzX
= 100 + Rnd * 20 TheItem
(i
).SzY
= 70 + Rnd * 14 TheItem
(i
).PosX
= Rnd * (SW
- TheItem
(i
).SzX
) TheItem
(i
).PosY
= Rnd * (SH
- TheItem
(i
).SzY
) TheItem(i).FileName = FakeText$(255)
'odious and tedious is this
TheRecord.Text = TheItem(i).Text
TheRecord.SzX = TheItem(i).SzX
TheRecord.SzY = TheItem(i).SzY
TheRecord.PosX = TheItem(i).PosX
TheRecord.PosY = TheItem(i).PosY
TheRecord.FileName = TheItem(i).FileName
' OK we got data filed! Now can we get it back
Print "Record Number:"; i
Print "Text: "; TheRecord.Text
Print "SzX:"; TheRecord.SzX
Print "SzY:"; TheRecord.SzY
Print "PosX:"; TheRecord.PosX
Print "PosY:"; TheRecord.PosY
Print "FileName:"; TheRecord.FileName
BlankString$
= Space$(lengthh
) FakeText$ = BlankString$