1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| var
i, data : Integer;
test : string;
F : File;
s : AnsiString;
begin
openDialog1.InitialDir := GetCurrentDir;
if openDialog1.Execute then
begin
AssignFile(F,openDialog1.FileName);
Reset(F, 1);
Seek(F, 0);
//Lecture du titre
BlockRead(f, data, 4);
//showmessage (inttostr(data));
SetLength(s, data);
BlockRead(f, s[1], data);
Edit1.Text := s;
//Lecture description
BlockRead(f, data, 4);
SetLength(s, data);
BlockRead(f, s[1], data);
Memo1.Text := s;
//Nombre de Wad dans le fichier
BlockRead(f, data, SizeOf(data));
//showmessage (inttostr(data));
//Lecture des données
SetLength(s, 128);
i :=0;
while not Eof(F) do
begin
if filepos(F)=filesize(F) then exit
//if Eof(F) = true then exit
else
begin
BlockRead(f, s[1], 128);
s:=stringreplace(extractfilename(s),ExtractFileExt(s),'',[]);
ListBox_Recap.Items.Add(s);
//Juste là pour tester le nb de boucle
inc (i, 1);
showmessage (inttostr(i));
end;
end;
Closefile(f);
end;
openDialog1.Free;
end; |
Partager