Pascal (Lazarus/Delphi)
Pascal (Lazarus/Delphi)
Reassemble a Previously Split File
Demonstrates how to reassemble a previously split file.Chilkat Pascal (Lazarus/Delphi) Downloads
program ChilkatDemo;
// Demonstrates using the Chilkat Pascal wrapper via the C bridge DLL.
// Builds as a console application under Lazarus (FPC) or Delphi.
{$IFDEF FPC}
{$MODE DELPHI}
{$ENDIF}
{$APPTYPE CONSOLE}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
SysUtils,
CkDllLoader,
Chilkat.FileAccess;
// ---------------------------------------------------------------------------
procedure RunDemo;
var
success: Boolean;
fac: TFileAccess;
reassembledFilename: string;
partPrefix: string;
partExtension: string;
srcDirPath: string;
begin
success := False;
fac := TFileAccess.Create;
// Any type of file may be reassembled. It doesn't matter if it's
// a binary file or a text file.
reassembledFilename := 'hamlet2.xml';
partPrefix := 'hamlet';
partExtension := 'spl';
srcDirPath := '.';
// Reassembles the original file from hamlet1.spl, hamlet2.spl, ...
success := fac.ReassembleFile(srcDirPath,partPrefix,partExtension,reassembledFilename);
if (success = True) then
begin
WriteLn('Success.');
end
else
begin
WriteLn(fac.LastErrorText);
end;
fac.Free;
end;
// ---------------------------------------------------------------------------
begin
try
RunDemo;
except
on E: Exception do
WriteLn('Unhandled exception: ', E.ClassName, ': ', E.Message);
end;
WriteLn;
{$IFDEF MSWINDOWS}
WriteLn('Press Enter to exit...');
ReadLn;
{$ENDIF}
end.