如何取目錄下檔案 |
答題得分者是:allenchan
|
nick167
中階會員 發表:86 回覆:133 積分:53 註冊:2003-02-12 發送簡訊給我 |
|
allenchan
資深會員 發表:10 回覆:306 積分:283 註冊:2004-01-06 發送簡訊給我 |
void __fastcall TForm1::Button1Click(TObject *Sender) { TSearchRec sr; String path = "c:\\xxx\\"; String mask = "*.*"; int iAttributes = 0; // iAttributes |= faReadOnly; // iAttributes |= faHidden; // iAttributes |= faSysFile; // iAttributes |= faVolumeID; // iAttributes |= faDirectory; iAttributes |= faArchive; // iAttributes |= faAnyFile; if (FindFirst(path mask, iAttributes, sr) == 0) { do { if ((sr.Attr & iAttributes) == sr.Attr) { Memo1->Lines->Add(path sr.Name); } } while (FindNext(sr) == 0); FindClose(sr); } }發表人 - allenchan 於 2004/12/10 18:28:32 |
nick167
中階會員 發表:86 回覆:133 積分:53 註冊:2003-02-12 發送簡訊給我 |
引言:??????????????????????? 這是delphi 語法嗎 ?void __fastcall TForm1::Button1Click(TObject *Sender) { TSearchRec sr; String path = "c:\\xxx\\"; String mask = "*.*"; int iAttributes = 0; // iAttributes |= faReadOnly; // iAttributes |= faHidden; // iAttributes |= faSysFile; // iAttributes |= faVolumeID; // iAttributes |= faDirectory; iAttributes |= faArchive; // iAttributes |= faAnyFile; if (FindFirst(path mask, iAttributes, sr) == 0) { do { if ((sr.Attr & iAttributes) == sr.Attr) { Memo1->Lines->Add(path sr.Name); } } while (FindNext(sr) == 0); FindClose(sr); } }發表人 - allenchan 於 2004/12/10 18:28:32 |
allenchan
資深會員 發表:10 回覆:306 積分:283 註冊:2004-01-06 發送簡訊給我 |
哈哈,沒注意,這是 BCB 的,Delphi 請參考
http://delphi.ktop.com.tw/topic.php?topic_id=40171
http://delphi.ktop.com.tw/topic.php?TOPIC_ID=20345 Delphi 的 Code 大概應該長下面這樣吧:
var sr : TSearchRec; path, mask : String begin path = 'c:\xxx\'; String mask = '*.*'; if FindFirst(path mask, faArchive, sr) = 0 then begin Repeat Memo1->Lines->Add(path sr.Name); Until FindNext(sr) <> 0; FindClose(sr); end; end;發表人 - allenchan 於 2004/12/10 20:17:13 |
nick167
中階會員 發表:86 回覆:133 積分:53 註冊:2003-02-12 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |