![]() |
| ||
|
|
Новости |
Поиск |
FAQ |
Статьи |
Книги |
Новости VCL
| | Форумы ЧАТ |
Орешник |
|
| |||
| |||
« предыдущая ветвь | форум | следующая ветвь »
код не создает более `273 files in ;win2000 [D5, NT4, Win2k]
Dmitriy(new) © (2001-12-13 19:37:00)код не создает более `273 files in win2000
procedure TForm1.Button1Click(Sender: TObject);
var SearchRec:Tsearchrec; f:file; b:array[0..16383]of byte; S,shortname,FileName:string; I,ExtNum,size :integer;
begin
// Create the Archive directory (if its not there)
FileName:="RAMIZ.RCV"; GlobalStop:=False;
{$i-}// chdir (".."); createdir ("R"); chdir (".."); {$i+}
// read the file
For I:=1 To 50000 Do Begin
If GlobalStop Then Break;
Label1.Caption:=inttostr(i); Application.ProcessMessages;
assignfile (f,FileName); reset (f,1); blockread (f,b,16384,size); closefile (f); //erase (f);
ExtNum:=1000; ShortName:="..\r\RAMIZ";
repeat
inc (ExtNum); S:= shortname+inttostr (ExtNum)+".RCV";
until findfirst (S,$3f,SearchRec)<>0;
assignfile (f,S);
rewrite (f,1);
blockwrite (f,b,size);
closefile (f);
end;
end;
Dmitriy(new) (2001-12-16 09:38:00) [1]> Макс Черных ©
спасибо
я думал что в Win 2000 глючит код
assignfile (f,FileName); reset (f,1); blockread (f,b,16384,size); closefile (f);
> Ю.Ю.
пример тестовый
Ю.Ю. (2001-12-14 06:52:00) [2]Зачем 50000 раз считывать один и тот-же файл "RAMIZ.RCV"?
Зачем искать файл, если вызвыается Rewrite ?
Rewrite creates a new external file with the name assigned to F.
If an external file with the same name already exists, it is deleted and a new empty file is created in its place.
Макс Черных (2001-12-13 22:47:00) [3]1. чудесатый код какой-то.
2. Что сразу в глаза бросается:
repeat
inc (ExtNum); S:= shortname+inttostr (ExtNum)+".RCV";
until findfirst (S,$3f,SearchRec)<>0; //<<<<-----
assignfile (f,S);
Каждому вызову findfirst должен соответствовать вызов FindClose,
а иначе можно очень быстро систему без ресурсов оставить.
См. help раздел: "FindFirst function"
Dmitriy(new) (2001-12-13 20:40:00) [4]HELP !!!!
Dmitriy(new) (2001-12-13 20:23:00) [5]и что не кто не можем понять