From: utzoo!decvax!cca!mcmanis.mark@Usc-Eclc@sri-unix
Newsgroups: net.micro
Title: Re: Microsoft BASIC problem
Article-I.D.: sri-unix.2813
Posted: Sat Aug 21 03:39:59 1982
Received: Sun Aug 22 02:17:57 1982

From: Mark Moulding 

Actually, the fact that MBASIC doesn't see EOF marks ( or physical EOF) in
random file mode is not really a bug after all.  First, since in random
mode the usual data that goes into the file is binary representations of
numbers and such-like, a ^Z (ascii EOF) is likely to appear at any time.
More important, however, is that it is possible to write (and subsequently
read) non-contiguous random records.  (e.g., I could do a PUT to records
1,10, and 100 on a file that I'd just created, and therefore empty.)  Thus,
there really isn't any true EOF.  Incedentally, if you try to read a record
(randomly) that hasn't been written, MBASIC is kind enough to fill the file
buffer with all zeros, thus causing all number conversions to return zero.

I agree, however, that it would be handy to have an easy way of finding the
last record.  (The function LOF is also of no use for this job.)  About the
simplest way seems to be to dedicate the first record as the file maintenance
record (which you'd probably need in any reasonable sized program anyway), 
and keep in it a pointer to the first free record.

					Mark
-------