J
jbas
Unregistered / Unconfirmed
GUEST, unregistred user!
下面是我的代码,总是报错地址出错。
unit Unit2note2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
const
FN_NOTES='note.dat';
type
TNoteRecord=packed record
Fcapture:string[30];
Fmemo:string[255];
end;
TForm2 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var
RRecord:tNoteRecord;
rfile:file of Tnoterecord;
ce,me:string;
begin
ce:=form2.Caption;
me:=form2.Memo1.Text;
with RRecord do
begin
Fcapture:=ce;
Fmemo:=me;
end;
assignfile(RFile,FN_NOTES);
if not fileexists(FN_NOTES) then
rewrite(RFile)
else
begin
reset(RFile);
seek(RFile,filesize(RFile));
write(RFile,RRecord);
closefile(rfile);
end;
end;
end.
unit Unit2note2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
const
FN_NOTES='note.dat';
type
TNoteRecord=packed record
Fcapture:string[30];
Fmemo:string[255];
end;
TForm2 = class(TForm)
Memo1: TMemo;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var
RRecord:tNoteRecord;
rfile:file of Tnoterecord;
ce,me:string;
begin
ce:=form2.Caption;
me:=form2.Memo1.Text;
with RRecord do
begin
Fcapture:=ce;
Fmemo:=me;
end;
assignfile(RFile,FN_NOTES);
if not fileexists(FN_NOTES) then
rewrite(RFile)
else
begin
reset(RFile);
seek(RFile,filesize(RFile));
write(RFile,RRecord);
closefile(rfile);
end;
end;
end.