function FileLength(Filename:string):integer;<br>var<br> fp:file of byte;<br>begin<br> AssignFile(fp,Filename);<br> Reset(fp);<br> Result := FileSize(fp);<br> CloseFile(fp);<br>end;<br>或者<br>var<br> hFile : Integer;<br>begin<br> hFile:=CreateFile(PChar('c:/temp/a.htm'), GENERIC_READ, 0, nil,<br> OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);<br> Edit1.Text := IntToStr(GetFileSize(hFile, 0));<br>end;