best way to isolate record # in a flat file.
Posted on 2001-08-21
Ok folks. I'm writing a program that reads data from a datafile that is generated within the system. Since it's a standard delphi typed file handle, I am using filepos, filesize, and seek to move to record numbers. However, for some reason, my code keeps seeking me to record #0 or #1 or #2. I can never get to #2 or above. Here's an illustration of what I'm doing:
type datafilerecord = record
deleted : boolean;
In my function to move to the next record, I have this:
procedure TDvdCatForm.NextRecBtnClick(Sender: TObject);
var thefilepos : integer; // for debugging
TheFilePos := filepos(moviefile); // for debugging
The first time I press button named NextRecBtn, I get record #1 (ok), Next time I press the button, I could get #2 (ok) or I could get #1 again (WHAT!?)
Please don't tell me to use BDE or ODBC or anything. I have no experience in them and frankly I don't want to use them.
What am I doing wrong?