Txxx = packed record ID :integer; Name :string; Age :Byte; end;procedure ReadxxxFile(const filename :string); var DataFile :File of Txxx; xxx :Txxx; begin AssignFile(DataFile, filename); Reset(DataFile); try if not EOF(DataFile) then read(DataFile, xxx); finally CloseFile(DataFile); end; end;
ID :integer;
Name :string;
Age :Byte;
end;procedure ReadxxxFile(const filename :string);
var
DataFile :File of Txxx;
xxx :Txxx;
begin
AssignFile(DataFile, filename);
Reset(DataFile);
try
if not EOF(DataFile) then
read(DataFile, xxx);
finally
CloseFile(DataFile);
end;
end;
SL: TStringlist;
begin
SL := TStringlist.Create;
try
SL.Loadfromfile('D:\你的文件');
//SL[0]就是第二行的内容,sl[1]第二行的容,SL.text就是整个文件的内容
//写已写代码处理你想要的
finally
SL.free;
end;
end;