全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1338
推到 Plurk!
推到 Facebook!

Delphi-自動讀取同目錄多個檔案的問題

答題得分者是:Miles
jeff_chung
一般會員


發表:2
回覆:1
積分:0
註冊:2005-07-16

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-07-22 08:50:23 IP:61.218.xxx.xxx 未訂閱
各位大大, 請問如何自動讀取同目錄多個檔案,openfile的function只能讀取一個, 如何依序讀取多個檔案?
Miles
尊榮會員


發表:27
回覆:662
積分:622
註冊:2002-07-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-07-22 15:09:57 IP:218.172.xxx.xxx 未訂閱
Hi jeff_chung 你好: 試試

var
  sr: TSearchRec;
  FileAttrs: Integer;
  Showed : boolean;
  F1 : TextFile;
begin
  Showed := False;
  if FindFirst('C:\*.*', faAnyFile, sr) = 0 then begin
     while FindNext(sr) = 0 do begin
           if (sr.Name = '.') or (sr.Name = '..') then continue;
           if ((sr.Attr and faDirectory) = faDirectory) then
              Continue
           else begin
           //=========開檔讀檔=======
              AssignFile(F1, 'c:\' sr.Name);
              .
              . 
           end;
           Application.ProcessMessages;
     end;
  end;
  FindClose(sr);
end;
我不是高手, 高手是正在銀幕前微笑的人.
------


我不是高手, 高手是正在銀幕前微笑的人.
系統時間:2024-05-03 4:26:06
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!