[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | AMIGA NOTES |
Notice: | Join us in the *NEW* conference - HYDRA::AMIGA_V2 |
Moderator: | HYDRA::MOORE |
|
Created: | Sat Apr 26 1986 |
Last Modified: | Wed Feb 05 1992 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 5378 |
Total number of notes: | 38326 |
2277.0. "AmigaBasic Random File Problem" by ADODEM::MCGHIE (looking for a door...) Fri Feb 24 1989 23:53
Hi People,
Just a warning about using AmigaBasic for those people who use it.
I was trying to write a program to test Random file access.
I wrote a small program to write 100 records to a random file. It
then let me read a record specified by record number. I was using
the EOF function to determine whether or not the record had been
read correctly. When I initialised the file each record contained
the record number as part of the record structure.
What I found was the following :-
Action Result
Read record 10 Got record 10, eof false
Read record 45 Got record 45, eof false
Read record 1000 Got record 46, eof false
Read record 500 Got record 47, eof false
Read record 75 Got record 75, eof false
Read record 101 Eof true.
Read record 102 Eof true.
I haven't tested it any further to date, I've been out of town for
a week. My test file was in the ram disk.
I'm going to test it further at some point and post the results
here.
Regards
Mike
T.R | Title | User | Personal Name | Date | Lines |
---|
2277.1 | work-around available | CGFSV1::WADLEIGH | Dave in Calgary, Alberta | Sat Feb 25 1989 01:37 | 7 |
| What to do?
When you write a record that causes the file to be extended beyond
the previous EOF, the EOF will be unreliable until you close the
file and re-open it again.
Just close and reopen the file after you've extended it, and you'll be OK.
|
2277.2 | deleteing records from raf's | NZOV01::MCKENZIE | Nuke the Leprechaun! | Sun Feb 26 1989 14:27 | 7 |
| just out of interest - how do you DELETE records from a random access
file???
I know GET is used to read and PUT to write but how do you cream
a record from a file permanantly??
Phil
|
2277.3 | exit | ADODEM::MCGHIE | looking for a door... | Sun Feb 26 1989 18:59 | 19 |
| re: .1
Thanks for that, I'll check it some more. But after trying to use
amigabasic for a largish program (>25k) I'm of the opion that its
basically a waste of time to use it. However given the cost of
compilers I don't have a lot of choice at the moment.
re: .2
Typically you don't delete records out of random files. Once the
record space has been allocated, that's it.
I would put an in-user flag into the record and set it to false
if it was to be deleted so it could be re-used. The other alternative
is to run a small program to re-claim 'deleted' (i.e. not in use)
by copying in-user records to a new file.
regards
Mike
|