Разное
Последние книги
Самое популярное
Все бесплатно
Все ссылки на файлы, расположенные на страницах сайта, добавлены пользователями и доступны для бесплатного скачивания. За содержание этих файлов администрация сайта ответственности не несет.
Навигация
Вопросы
Delphi - База Знаний: Как соединить несколько файлов в один
Исходник на DELPHI, выполняющий аналог DOS команды copy file1 + file2 + file3 file4
Первый вариант
procedure TForm1.Button1Click(Sender: TObject);
var
Stream1, Stream2: TFileStream;
begin
Stream1 := TFileStream.Create('c:file4', fmCreate or fmShareExclusive);
try
{ first file }
Stream2 := TFileStream.Create('c:file1', fmOpenRead or fmShareDenyNone);
try
Stream1.CopyFrom(Stream2, Stream2.Size);
finally
Stream2.Free;
end;
{ next file }
Stream2 := TFileStream.Create('c:file2', fmOpenRead or fmShareDenyNone);
try
Stream1.CopyFrom(Stream2, Stream2.Size);
finally
Stream2.Free;
end;
{ and so on }
finally
Stream1.Free;
end;
end;
by Finn Tolderlund
Второй вариант
function AppendFiles(Files: TStrings; const DestFile: string): integer;
var
srcFS, destFS: TFileStream;
i: integer;
F: string;
begin
result := 0;
if (Files.Count > 0) and (DestFile <> '') then
begin
destFS := TFileStream.Create(DestFile, fmCreate or fmShareExclusive);
try
i := 0;
while i < Files.Count do
begin
F := Files(i);
Inc(i);
if (CompareText(F, DestFile) <> 0) and (F <> '') then
begin
srcFS := TFileStream.Create(F, fmOpenRead or fmShareDenyWrite)