Andere Möglichkeit:
ms-help://embarcadero.rs_xe7/libraries/System.IOUtils.TFile.WriteAllBytes.html
Delphi-Quellcode:
procedure SaveBytesToFile3(const Data: TBytes; const FileName: string);
begin
TFile.WriteAllBytes( FileName, Data ); // uses System.IOUtils
end;
procedure TForm1.Button24Click(Sender: TObject);
var Data : TBytes;
FN : String;
SO : Cardinal;
Ticks: DWord; Res : Single;
begin
SO:= 1000000000; // 1GB
FN:='G:\TEST\BIGFILE1GB.txt';
SetLength( Data, SO);
FillChar( Data[0], SO, $41);
Memo1.Lines.Add('Start creating '+FN);
Ticks := timeGetTime; //uses MMSystem
SaveBytesToFile3(Data,FN);
Res := 0.001 * (timeGetTime - Ticks);
Memo1.Lines.Add(Format('Time for creating '+FN+' : '+' %.3f s',[Res]));
Memo1.Lines.Add('Speed per sec: '+ floattostrf(SO / Res, ffNumber, 10, 0)+' Bytes/sec');
end;
--------------------------
USB3.0 - 240GB SSD
Start creating G:\TEST\BIGFILE1GB.txt
Time for creating G:\TEST\BIGFILE1GB.txt : 4,571 s
Speed per sec: 218.770.505 Bytes/sec
Start creating G:\TEST\BIGFILE1GB.txt
Time for creating G:\TEST\BIGFILE1GB.txt : 4,720 s
Speed per sec: 211.864.416 Bytes/sec
----------------------------------------