S
SP229
Unregistered / Unconfirmed
GUEST, unregistred user!
对这个一点不懂!
想定义一个结构,不知对不对?
type
TGsRec = packed record
Gs_Name: string[12];
LD: String[6];
ZS: integer;
GS_File: TStrings;
aDate: TDate;
end;
var
aDateF: file of TGsRec;
GsRec: TGsRec;
aFileName: string='D:/Gs.jjg';
procedure TForm1.Button6Click(Sender: TObject);
begin
AssignFile(aDateF,aFileName);
Rewrite(aDateF);
GsRec.Gs_Name:=edit1.Text;
GsRec.LD:='D';
GsRec.ZS:=15;
GsRec.GS_File:=memo2.Lines;
GsRec.aDate:=now;
Write(aDateF,GsRec);
CloseFile(aDateF);
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
AssignFile(aDateF,aFileName);
Reset(aDateF);
memo1.Clear;
seek(aDateF,strtoint(edit3.Text));
Read(aDateF,GsRec);
memo1.Lines.Add(GsRec.Gs_Name);
memo1.Lines.AddStrings(GsRec.GS_File);
CloseFile(aDateF);
end;
如果清除memo2中的内容,memo1中什么也没有,好象mwmo2中的内容并没有保存到文件中
如果要把memo2中的内容保存到文件中该如何做?
想定义一个结构,不知对不对?
type
TGsRec = packed record
Gs_Name: string[12];
LD: String[6];
ZS: integer;
GS_File: TStrings;
aDate: TDate;
end;
var
aDateF: file of TGsRec;
GsRec: TGsRec;
aFileName: string='D:/Gs.jjg';
procedure TForm1.Button6Click(Sender: TObject);
begin
AssignFile(aDateF,aFileName);
Rewrite(aDateF);
GsRec.Gs_Name:=edit1.Text;
GsRec.LD:='D';
GsRec.ZS:=15;
GsRec.GS_File:=memo2.Lines;
GsRec.aDate:=now;
Write(aDateF,GsRec);
CloseFile(aDateF);
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
AssignFile(aDateF,aFileName);
Reset(aDateF);
memo1.Clear;
seek(aDateF,strtoint(edit3.Text));
Read(aDateF,GsRec);
memo1.Lines.Add(GsRec.Gs_Name);
memo1.Lines.AddStrings(GsRec.GS_File);
CloseFile(aDateF);
end;
如果清除memo2中的内容,memo1中什么也没有,好象mwmo2中的内容并没有保存到文件中
如果要把memo2中的内容保存到文件中该如何做?