02-24-2026, 06:58 AM
(02-24-2026, 06:06 AM)PhilOfPerth Wrote: Thanks all; I now have a prog that generates R/A files of words of any length (up to 15 letters).This is pretty cool, but it has given me another idea. It would be possible to leave the original Word file as Plain text with any length words and build an Index file for it
May be useful to other word-game freaks)!
The word- file attached is the "cleaned-up" Collins dictionaryCode: (Select All)SW = 1040: SH = 720
Screen _NewImage(SW, SH, 32)
SetFont: F& = _LoadFont("C:\WINDOWS\fonts\courbd.ttf", 20, "monospace"): _Font F&
_ScreenMove (_DesktopWidth - SW) / 2, 90
'get longest data length 10, length of FLASHPOINT
Input "Max Data length"; MaxLength
RL = MaxLength + 2 ' Len needs to be extended by 2 bytes
RandFile$ = "RandTo" + LTrim$(Str$(MaxLength))
RecNum = 0
Open "SerialWords.txt" For Input As #1
Open RandFile$ For Random As #2 Len = RL 'prepare R/A file
' Read each word and write to random file
While Not EOF(1)
Input #1, wrd$
If Len(wrd$) <= MaxLength Then
' only put words up to length requested
RecNum = RecNum + 1
Put #2, RecNum, wrd$
End If
Wend
Close
Print "Created "; RandFile$; " with "; RecNum; " records": Sleep 2
Cls
' Verify the random access file
Print: Print "Reading sample from random access file:"
Open RandFile$ For Random As #1 Len = MaxLength + 2
For a = 1 To 20
Get #1, a, wrd$: Print wrd$; " ";
Next
Close
End
Sleep
with long (or even _INTEGER64 but long is probably fine !) values that represent the File Positions of each word in the Text file ! It would save space on VERY large word files.
The file would only have to be indexed once if static or otherwise it would need to be reindexed each time it was changed !

