buffer: array[0..65535] of char;
ZeroMemory(@buffer, sizeof(buffer));
[...]
Source := CreateFile(PChar(src), GENERIC_READ, 0, nil, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, 0);
Dest:= CreateFile(PChar(dest), GENERIC_WRITE, 0, nil, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
[...]
alire := sizeof(buffer);
aecrire := alire;
totalecrit := 0;
while totalecrit < total do
begin
// si "alire" est inférieur à la taille du buffer, // alors la fonction ne lit rien du tout :(
ReadFile(Source, buffer, alire, lu, nil);
WriteFile(Dest, buffer, aecrire, ecrit, nil);
if totalecrit + alire > total then
begin
alire := total - totalecrit ;
aecrire := alire;
end;
end;
|