I use the following 9 lines to put the bytes of a file NameF in vector T() in FreeBasic 0.4.6 FBide.
Is there a better or shorter way?
DIM L as ulong, NameF as string
Input "Enter Name of the File", NameF
Open NameF For Binary As #1
L= LOF(1)
Close #1
DIM T(1 to L) As Ubyte
Open NameF For Binary Access Read As #1
Get #1, , T()
Close #1
The 9 lines work OK. I am looking for improvement if feasible.
Then 3 lines off is better (no need for the separate L variable, as well as the redundant
CloseandOpencommands):