NEWBIE: Exception error help please

Hi steve, I didn't really look at the code yet cause the error gave me a
hint. Read of address FFFFFFFF occurs when you try to access an
object/component or memory that hasn't been created/allocated. Try looking
for points where you try to access any object and check if it's been created
and not yet destroyed at that point.

HTH
  Roel

Quote
Steve <St...@cutthisout.tenchy.demon.co.uk> wrote:
> Hi,
> I'm trying my first program in Deplhi 2. The code below is producing
> the following error when I shut down the program, after it seems to
> have completed the section of code OK.
> My *.prn file is an ASCII file of one string per record, from which I
> am extracting parts of it for the numbers they represent.
> I've decared the Contacts array (integer) after the line
> {$R *.DFM}
> so I can use it globally.
> Can someone tell me whats up ?
> Win95 OSR2,Delphi 2, 64meg ram.
> ERROR:
> Exception EAccessViolation in Module HEADINGS.EXE at 00001758.
> Acces violation at address 00402958. Read of address FFFFFFFF.
> CODE:
> procedure TForm1.BitBtn1Click(Sender: TObject);
> var
>    FName: string;
>    DataIn: textfile;
>    InputText: String;
>    Temp: Integer;
>    Subscript: Integer;
>    Points: Integer;
>    StringError: Integer;
> begin
>      FName:='';
>      with OpenDialog1 do
>           begin
>                Title:='Select data file';
>                InitialDir:='d:\masters\radio\g0gjv';
>                Filter:='Prn Files (*.prn)|*.prn';
>           end;
>      OpenDialog1.Execute;
>      FName := OpenDialog1.FileName;
>      AssignFile(DataIn,FName);
>      Reset(DataIn);
>      while not eof(DataIn) do
>            begin
>            ReadLn(DataIn,InputText);
>            if InputText>'' then
>               begin
>               Canvas.TextOut (10,ClientHeight div 2, InputText);
>               VAL(Copy(InputText,41,1),Subscript,StringError);
>               Contacts[Subscript,1]:=Contacts[Subscript,1]+1;
>               VAL(Copy(InputText,46,4),Temp,StringError);
>               Contacts[Subscript,2]:=Contacts[Subscript,2]+Temp;
>               end;
>            end;
>            CloseFile(DataIn)
> end;
> Many TIA