type
TMyFile=file of byte;
TMyBuffer=array of byte;
procedure TForm1.Button1Click(Sender: TObject);
var
myFile:TMyFile;
myBuf:TMyBuffer;
i:integer;
begin
try
AssignFile(myFile,'dat.dat');
setLength(myBuf,10);
for i := low(myBuf) to high(myBuf) do
myBuf := byte(i);
ReWrite(myFile);
BlockWrite(myFile,myBuf,10);
finally
myBuf := nil;
CloseFile(myFile);
end;
end;