我有33个文本文件里的数据要依次读入,怎么读啊,急啊

解决方案 »

  1.   

    把文件名倒入一个stringlist中,然后一个个倒入
      

  2.   

    例有:OpenDialog1
    var
      fileList: TStrings;
    begin
      fileList.Assign(OpenDialog1.FileLists);
      for i := 0 to fileList.Count do
      begin
        //loadFile(fileList.Strings[i]);
      end; 
    end;
      

  3.   

    var
      opf:textfile;
    ...for i:=1 to OpenDialog1.Files.Count do
    begin
       AssignFile(opf,OpenDialog1.Files.Strings[i-1]);
        reset(opf); 
        ....读数据
       closefile(opf);
    end;
      

  4.   

    var
      found,attr,DoFirst,strindex:integer;
      f:tsearchrec;
      StrListCur,StrListAll:Tstringlist;
      ItsDir:string;
    begin
         strlistcur:=Tstringlist.Create;
         strlistall:=Tstringlist.Create;
         DoFirst:=1;
         found:=0;
         ItsDir:='d:\abc\';//这是你的源文本的文件夹
         while found=0 do
            begin
            if DoFirst=1 then
               begin
               Found := FindFirst(ItsDir+'*.txt',faAnyFile,F);
               DoFirst:=0;
               end else found := findNext(f);
            if found=0 then
               begin
               StrListCur.LoadFromFile(ItsDir+f.Name);
               for strindex:=0 to strlistcur.Count-1 do
                   strlistall.Add(strlistcur.Strings[strindex]);
               end;
            end;
         strlistall.SaveToFile(ItsDir+'result.txt');//全部文本文件合并为result.txt
         strlistcur.Free;
         strlistall.Free;
         FindClose(f);
    end;
      

  5.   

    copy *.txt read.txt  or copy 1.txt +2.txt read.txt
    type read.txt