把文件读入内存中,就是二进制的文件流
var
FS: TFileStream;
MM: TMemoryStream;
Buf: Array of Byte;
begin
FS := TFileStream.create('aa.bat', fmOpenRead);
MM := TMemoryStream.create;
CopyMemory(MM, FS, 100);
...
SetLength(Buf, MM.Size);
FS := TFileStream.create('aa.bat', fmOpenWrite);
FS.WriteBuffer(Buf, SizeOf(Buf));
...
end;