bonjour à tous
Je cherche à accélérer un peu mon code qui est très lent
Voici le code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
var Buffer : array[0..2097151] of byte;//(petit fichier : 2Mo)
     PosA : Longword;
     S,S1:string;
 
F:=TFileStream.Create(nomfichier,fmOpenRead);
F.Read(Buffer,F.Size);
F.Free;
 
PosA:=0;
s:='4442405454543031';
While (PosA < (f.size-1)) or (s1=s) do
begin
s1:=inttohex(ord(buffer[PosA]),2)+inttohex(ord(buffer[PosA+1]),2)+inttohex(ord(buffer[PosA+2]),2)+inttohex(ord(buffer[PosA+3]),2)+inttohex(ord(buffer[PosA+4]),2)+inttohex(ord(buffer[PosA+5]),2)+inttohex(ord(buffer[PosA+6]),2)+inttohex(ord(buffer[PosA+7]),2);
if s1 = s then
begin
// ==> action à effectué
end;
PosA:=PosA+1;
end;
Y a t-il un moyen plus rapide et plus grâcieux de faire la même chose?
A savoir que je ne peux ouvrir ce fichier qu'avec un éditeur héxadécimal
Merci de votre aide