用tstringlist,随便写的,自己调试一下
var fname:string;
sl:tstringlist;
begin
fname:='c:/a.txt';
sl:=tstringlist.create;
sl.append('1');
sl.append('2');
sl.append('3');
sl.savetofile(fname);
sl.free;
end;
var fname:string;
sl:tstringlist;
i:integer;
begin
fname:='c:/a.txt';
sl:=tstringlist.create;
sl.loadfromfile(fname);
for i:=0 to sl.count-1 do
showmessage(sl.strings);
sl.free;
end;