[fpc-pascal]Small Problem

ivica munitic imunitic at yahoo.com
Sun Feb 24 17:00:24 CET 2002


Hi All!
I'm writting a small adressbook and this peace of code
gives me an error I can't resolve:
The error is:
An unhelded exception occured at 0x004018B0 :
Read past end of file
 0x004018B0
 0x00401B9B
 0x00404821

But in the function ReadFromFile I'm checking for the
end of file in the While not eof(TFile) part of the
code.
Please Help.

function ReadFromFile (Head : PPerson; Var TFile :File
) : PPerson;
Var
   Current : PPerson;
   Last    : PPerson;
begin
     Current := Head;
     Last := Current;

     Assign (TFile,ADDRFILE);
     Reset(TFile,1);

While not eof(TFile) do begin
 
BlockRead(TFile,Current^.FName,Length(Current^.FName)
+ 1);

BlockRead(TFile,Current^.LName,Length(Current^.LName)
+ 1);

BlockRead(TFile,Current^.Address,Length(Current^.Address)
+ 1);


BlockRead(TFile,Current^.PhNumber,Length(Current^.PhNumber)
+ 1);
                    
 BlockRead(TFile,Current^.EMail,Length(Current^.EMail)
 + 1);
                    
 BlockRead(TFile,Current^.URL,Length(Current^.URL)
+1);

     if not eof(TFile) then begin
                New(Current);
                Last^.Next := Current;
     end;
          Current^.Next := Nil;
end;

     Close(TFile);
     ReadFromFile := Head;
end;


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - Coverage of the 2002 Olympic Games
http://sports.yahoo.com




More information about the fpc-pascal mailing list