Delphi Tips&Tricks News   Tips   .NET Software   VCL Software   Search   Contacts
Ultimate Pack - special offer!

Ultimate Pack  hot!
Image Editor  new!
Runtime Fusion
Form Designer
Object Inspector
Print Suite Pro
Commented Image
Delphi Toys
WinDowse
Delphi Bonus
TMS Scripter Studio
Form Designer VB
Form Designer .NET

...get more...
for Delphi.NET, C#, VB.NET
for Delphi VCL, BCB 3-6

WinAPI Online
Unix Manual Pages
MegaDetailed.NET
in3steps.com
cdtrrracks.com new!

Blogspot  greatis.blogspot.com

Append one file to other - Files & folders - Tips & Tricks - Greatis Delphi Pages

You may copy contents of a first file to [new.$] file. After that, you may add contents of a second file to [new.$] and then delete first file and rename [new.$] file to name of the first file.


procedure TForm1.Button3Click(Sender: TObject);
var
  Str: string;
  F1, F2, F3: TextFile;
begin
  Label3.Caption:='Processing...';
  AssignFile(F1, Edit1.Text);
  AssignFile(F2, Edit2.Text);
  AssignFile(F3, 'new.$');
  Reset(F1);
  Reset(F2);
  Rewrite(F3);
  while not(EOF(F1)) do
  begin
    Readln(F1, Str);
    Writeln(F3, Str);
  end;
  while not(EOF(F2)) do
  begin
    Readln(F2, Str);
    Writeln(F3, Str);
  end;
  CloseFile(F1);
  CloseFile(F2);
  CloseFile(F3);
  DeleteFile(ExtractFileName(Edit1.Text));
  RenameFile('new.$', ExtractFileName(Edit1.Text));
  DeleteFile('new.$');
  Label3.Caption:='Processing done';
end;
For more
Delphi Help

Download source