V
Vinson
Unregistered / Unconfirmed
GUEST, unregistred user!
比如,类型文件中的记录结构如下:
TPersonRec=packed record
FirstName:String[20];
LastName:String[20];
Birthday:TdateTime;
Age:Integer;
end;
我们可以用如下代码增加一条记录:
var
PersonRec:TPersonRec;
DataFile:File of TPersonRec;
begin
AssignFile(DataFile,'PersonFile.Dat');
Reset(DataFile);
Seek(DataFile,FileSize(DataFile));
try
Write(DataFile,PersonRec);
Finally
CloseFile(DataFile);
end;
end;
但怎样删除一条记录呢?
TPersonRec=packed record
FirstName:String[20];
LastName:String[20];
Birthday:TdateTime;
Age:Integer;
end;
我们可以用如下代码增加一条记录:
var
PersonRec:TPersonRec;
DataFile:File of TPersonRec;
begin
AssignFile(DataFile,'PersonFile.Dat');
Reset(DataFile);
Seek(DataFile,FileSize(DataFile));
try
Write(DataFile,PersonRec);
Finally
CloseFile(DataFile);
end;
end;
但怎样删除一条记录呢?