You can manage the file by having 2 pointers - one that
points to the last record written and one that points
to the first record in the sequence. Note that you must use
fixed length-records, otherwise if you over-write a 'short'
record with a longer record, it will over-write part of the
next record.
You can store your 2 pointers in the registry or in an
auxiliary data file.
When you want to read the sequence of records:
- position to the first record
- read all records until EOF
- start at the beginning and read up to the first record
When you write the next record, you do this:
- get the pointer to the last record written
- advance the pointer
- if it points past the maximum file length, reset to 0
- write the record (it might be new, extending the
file size or it might be over-writing an older record)
- if you just over-wrote the 'first record', increment the
'first record' too (wrap to 0 if required)
- update both pointers (registry)
You'll note that none of this requires you to re-write the
file, truncate it or delete records. It will grow from 0 to
a maximum size, then it will remain the same size as new
records continue to over-write older records in the file.
--
John A. Grant * I speak only for myself * (remove 'z' to reply)
Radiation Geophysics, Geological Survey of Canada, Ottawa
If you followup, please do NOT e-mail me a copy: I will read it here
Thanks
Dan F. Rodriguez <d...@iby2.com> wrote in message
news:s7jocev...@corp.supernews.com...