View Single Post
  #1  
Old 05-01-2018, 06:03
Gupta Gupta is offline
Banned
 
Join Date: Aug 2016
Location: https://t.me/pump_upp
Posts: 399
Thanks: 139
Thanked 715 Times in 231 Posts
Gupta is on a distinguished road
Send a message via ICQ to Gupta Send a message via AIM to Gupta Send a message via Yahoo to Gupta
Join many Files to One using Inno Only

Code:
const
  joinFileBufsize = 4096;

procedure ConcatenateFiles(const InFileNames: array of string; const OutFileName: string);
var
  i: Integer;
  InStream, OutStream: TFileStream;
  read : longInt;
  Buffer : string;
begin
  OutStream := TFileStream.Create(OutFileName, fmOpenwrite);
  try
    // if not done so, read() will fail, maybe it internally assumes that bufsize is 0
    for i := 0 to joinFileBufsize do
      buffer := buffer + '0';
    for i := 0 to high(InFileNames) do
    begin
      InStream := TFileStream.Create(InFileNames[i], fmOpenRead);
      try
        while InStream.Position <> InStream.Size do
        begin
          read := InStream.Read(buffer,joinFileBufsize);
          OutStream.Write(buffer,read);
        end;
      finally
        InStream.Free;
      end;
    end;
  finally
    OutStream.Free;
  end;
end;

function InitializeSetup(): Boolean;
begin
  ConcatenateFiles(['test.iss','join.iss'],'JoinTest');
end;
Reply With Quote
The Following 4 Users Say Thank You to Gupta For This Useful Post:
78372 (05-01-2018), ADMIRAL (21-05-2020), EzzEldin16 (05-01-2018), Simorq (27-02-2018)
Sponsored Links