Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Indexed files
#10
(11-04-2023, 01:20 AM)JamesAlexander Wrote: 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).

Thanks James. I'll experiment with this. The records are of different lengths, so I may need to use fixed-length strings as also suggested.
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) Big Grin
Please visit my Website at: http://oldendayskids.blogspot.com/
Reply


Messages In This Thread
Indexed files - by PhilOfPerth - 11-03-2023, 11:21 PM
RE: Indexed files - by a740g - 11-03-2023, 11:40 PM
RE: Indexed files - by bplus - 11-03-2023, 11:44 PM
RE: Indexed files - by bplus - 11-03-2023, 11:50 PM
RE: Indexed files - by TerryRitchie - 11-03-2023, 11:55 PM
RE: Indexed files - by bplus - 11-03-2023, 11:55 PM
RE: Indexed files - by SMcNeill - 11-04-2023, 12:29 AM
RE: Indexed files - by bplus - 11-03-2023, 11:57 PM
RE: Indexed files - by JamesAlexander - 11-04-2023, 01:20 AM
RE: Indexed files - by PhilOfPerth - 11-04-2023, 01:39 AM
RE: Indexed files - by mnrvovrfc - 11-04-2023, 02:21 AM
RE: Indexed files - by PhilOfPerth - 11-04-2023, 07:44 AM
RE: Indexed files - by bplus - 11-04-2023, 11:54 AM
RE: Indexed files - by SMcNeill - 11-04-2023, 12:42 PM
RE: Indexed files - by Dimster - 11-04-2023, 01:57 PM
RE: Indexed files - by bplus - 11-04-2023, 04:50 PM
RE: Indexed files - by Kernelpanic - 11-04-2023, 11:13 PM
RE: Indexed files - by PhilOfPerth - 11-05-2023, 12:21 AM
RE: Indexed files - by bplus - 11-05-2023, 01:55 PM
RE: Indexed files - by PhilOfPerth - 11-05-2023, 11:31 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  More info about Random Access files PhilOfPerth 28 952 02-25-2026, 01:50 PM
Last Post: ahenry3068
  Embedding and Extracting MANY files ! ahenry3068 20 1,552 11-15-2025, 10:19 AM
Last Post: ahenry3068
  program that stitches together a bunch of image files into one giant poster? madscijr 15 2,358 10-24-2024, 06:08 PM
Last Post: madscijr
  Linux HTTP WEB Server Issues - Large Files Fail old_coder 0 457 03-27-2024, 08:33 PM
Last Post: old_coder
  Making the content list of files inside a Zip ? euklides 13 2,396 02-08-2024, 03:52 PM
Last Post: euklides

Forum Jump:


Users browsing this thread: 1 Guest(s)