Вниз
Скачать: CL | DM;

Как получить размер файла в байтах?   Найти похожие ветки 

 
Lamerr ©   (2003-05-09 10:56) [0]

Собственно, сабж.
Нашел GetFileSize, но туда надо передавать дескриптор, который надо еще получить...
Нет ли способа попроще?


 
Lamerr ©   (2003-05-09 11:33) [1]

Кажется, выкрутился...
Вопрос снимается.


 
german goering   (2003-05-09 11:41) [2]

Два способа:

procedure TForm1.Button1Click(Sender: TObject);
var hFile: Cardinal;
Size: Cardinal;
begin
with TOpenDialog.Create(Self) do
try
if Execute then
begin
hFile := FileOpen(FileName,fmOpenRead);
try
Size := GetFileSize(hFile,nil);
ShowMessage("Filesize of """ + FileName + """ is " + IntToStr(Size) + " bytes");
finally
FileClose(hFile);
end;
end;
finally
Free;
end;
end;

procedure TForm1.Button2Click(Sender: TObject);
var SearchRec: TSearchRec;
begin
with TOpenDialog.Create(Self) do
try
if Execute then
try
if FindFirst(FileName,faAnyFile,SearchRec) = 0
then
ShowMessage("Filesize of """ + FileName + """ is " + IntToStr(SearchRec.Size) + " bytes");
finally
FindClose(SearchRec);
end;
finally
Free;
end;
end;

?


 
Lamerr ©   (2003-05-09 11:50) [3]

Спасибо, буду иметь в виду.



Страницы: 1 вся ветка

Скачать: CL | DM;



Память: 0.45 MB
Время: 0.01 c
3-70130
pathfinder
2003-04-29 17:52
2003.05.22
Как добавить страницу в QuickReport?


1-70211
R2D2
2003-05-11 10:23
2003.05.22
Обработка Eoverflow - как?


3-70104
gnat
2003-04-29 06:49
2003.05.22
Shadow для IB


3-70162
Vanoshka
2003-05-02 13:22
2003.05.22
Базы данных InterBase


1-70300
Vin_Ghost
2003-05-12 20:21
2003.05.22
Как динамически объявить объект класса




   Наверх