• Please review our updated Terms and Rules here

BASIC Random Files

GeoffB17

Veteran Member
Joined
Jun 8, 2016
Messages
575
Location
Guisborough, England
I seem to remember from long ago that one of the old BASIC systems (original MS BASIC ?) had a supposed 'quirk' that was potentially useful.

If you create a Random file, and immed add, say, record 100 as a valid record, and then close the file, you in effect preserve all the garbage that might be in records 1 to 99. The BASIC code on creating the file/adding the record does NOT clear the data there. Later systems seem to do the latter by default?

I seem to remember that I did have the version of BASIC that did this, and this did work. Other versions just gave a file full of nothing, even if the disk SHOULD have had something there.

Does anyone know anything about this, or am I just imaging this?

Geoff
 
Depends on the operating system and the version of BASIC. So the answer is "yes" and "no".
Recall also, that CP/M and Windows NT+ support sparse random files.
 
Interesting - I've never thought Windows NT+ would support this? Do you have to do anything to make it happen? It seems like if you open a file and write towards the end of it that windows will expand the file (making it not be truly sparse).
 
We used to do that on the school PDP 11/70 running RSTS/E. We almost managed to scavenged the star trek source code from it.

All sorts of treasures would show up.

And, to be clear, I don't think we used BASIC for this, rathe we used a Fig Forth we typed in.

But, since, the OS wasn't clearing out tracks, I imagine the same thing could have happened with BASIC. I don't recall if it worked with virtual arrays or not.
 
You could even get a bit out of FAT systems; see the SEEJUNK utility (picks up stuff out of the last unfilled allocation unit). MS fixed that one eventually.
 
Back
Top