I'm on WinXP-32 SP3,
Lazarus : 0.9.30.4
FPC : 2.6.0-win32
I've written the following code to read a text file.
procedure TfmChiSquare.RadioGroup1Click(Sender: TObject);
var Buffer : String; F : Text;
begin
with Sender as TRadioGroup do
if ItemIndex = 1 then
{ If ItemIndex < 1, then user to enter data manually }
if OpenDialog1.Execute then
begin
System.Assign(F,OpenDialog1.FileName);
try
Reset(F);
while not eof(F) do
begin
Readln(F,Buffer);
{
Disambiguate(Buffer)
To be written routine to disambiguate Buffer
}
end;
finally
System.Close(F)
end;
end;
end;
Stepping through the code line by line, I get to the readln command. At that point, I get the following message:
Debugger Error
Ooooops, the debugger entered the error state
[NB: I may have the number of 'o's' wrong]
Save your work now!
Hit Stop, and hope the best, we're pulling the plug
That's the entire message with nothing omitted--except for the OK button.
The opendialog is acting perfectly and the opendialog1.FileName is exactly right.
I tried changing the "System.Assign(...)" command to "Assign(...)" but then I get the compiler error message that I haven't provided the correct number of parameters. So I went back to System.Assign.
I've tried redefining Buffer to ansistring. No help. I've tried redefining Buffer to array[0..80] of char. No help.
What am I doing that is so incredibly stupid that I can't even read a simple line from a text file?