求助:一个小程序,运行报错帮忙看看
以下代码在程序中加入了一个Clicklist的字符串列表,用户每按一次鼠标键,程序往Clicklist中加入一字符串,程序结束前把该列表存入文件。
unit Unit1;\\在此报错
interface
uses WinTYpes, WinProcs, Classes, Graphics, Forms, Controls, Apps;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
{ Private declarations }
public
{ Public declarations }
ClickList: TStrings; {declare the field}
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.FormCreate(Sender: TObject);
begin
ClickList := TStringList.Create; {construct the list}
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
ClickList.SaveToFile(ChangeFileExt(Application.ExeName, '.LOG'));
{save the list}
ClickList.Free; {destroy the list object}
end;
procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ClickList.Add(Format('Click at (%d, %d)', [X, Y])); {add a
string to the list}
end;
end.
报错信息:[错误] Unit1.pas(1): Illegal character in input file: ' ' ($A1A1)