11-04-2023, 01:20 AM
I think there is a better way to do this using the SEEK command.
You can do this and go directly here, circumventing all of the random using BINARY symbols instead:
file$ = "c:\myfile.dat"
OPEN FILE$ for BINARY as #1
Z$= CHR$ (0) ' Null value, Gets 1 symbol at a time.
SEEK #1,10 : 'Seek out the 10th symbol of the file.
GET #1 , , Z$: 'Get the symbol.
Print Z$: 'Prints the symbol
CLOSE #1
You can do this too in GWBASIC and Qbasic both, and around the time of GWBASIC, you were limited to a FIELD length of about 128 characters or less...
But this is the way to access files efficiently at a byte level (unless you have another more recent way using file direct access).
You can do this and go directly here, circumventing all of the random using BINARY symbols instead:
file$ = "c:\myfile.dat"
OPEN FILE$ for BINARY as #1
Z$= CHR$ (0) ' Null value, Gets 1 symbol at a time.
SEEK #1,10 : 'Seek out the 10th symbol of the file.
GET #1 , , Z$: 'Get the symbol.
Print Z$: 'Prints the symbol
CLOSE #1
You can do this too in GWBASIC and Qbasic both, and around the time of GWBASIC, you were limited to a FIELD length of about 128 characters or less...
But this is the way to access files efficiently at a byte level (unless you have another more recent way using file direct access).