X xujunjie Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-19 #1 文件很大,打开的时候很耗时,能不能不打开而获得文件长度?
X xianjun Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-19 #2 用Windows API: GetFileSize
死 死水 Unregistered / Unconfirmed GUEST, unregistred user! 2002-12-19 #3 function MyGetFileSize(const FileName: string): LongInt; var SearchRec: TSearchRec; begin if FindFirst(ExpandFileName(FileName), faAnyFile, SearchRec) = 0 then begin Result := SearchRec.Size; FindClose(SearchRec); end else Result := -1; end;
function MyGetFileSize(const FileName: string): LongInt; var SearchRec: TSearchRec; begin if FindFirst(ExpandFileName(FileName), faAnyFile, SearchRec) = 0 then begin Result := SearchRec.Size; FindClose(SearchRec); end else Result := -1; end;