type PhoneEntry = record FirstName, LastName: string[20]; PhoneNumber: string[15]; Listed: Boolean; end; var List1: file of PhoneEntry;
创建一个stringlist把数据读出来,然后调用stringlist.savetofile 方法
type {定义记录} MyRecord=record Name:string[20]; Tel:string[20]; Birthday:tdate; end; ... ... {事件中} var MyFile:file of MyRecord; //文件 begin if not fileexists('001.dat')... //如果不存在文件001.dat,创建。否则打开 reset(MyFile); //重新整理,准备写入数据/读出数据 ...end;
FirstName, LastName: string[20];
PhoneNumber: string[15];
Listed: Boolean;
end;
var List1: file of PhoneEntry;
{定义记录}
MyRecord=record
Name:string[20];
Tel:string[20];
Birthday:tdate;
end;
...
...
{事件中}
var
MyFile:file of MyRecord; //文件
begin
if not fileexists('001.dat')... //如果不存在文件001.dat,创建。否则打开
reset(MyFile); //重新整理,准备写入数据/读出数据
...end;