读取TXT文档示例

View Code
procedure  TForm1.btn2Click(Sender: TObject);
var  F:TextFile;
s:
string ;
begin
         
if  dlgOpen1.Execute  then
         
begin
           AssignFile(F,dlgOpen1.FileName);
           Reset(f);
          
while   not  Eof(F)  do
          
begin
             Readln(F,s);
             redt1.Lines.Add(s);
          
end ;
          CloseFile(F);

         
end ;
end ;

end .

你可能感兴趣的:(txt)