• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 282
  • Last Modified:

Append to file or Var

Hello everyone!

I have a file called  ABC.Dat
I want to Append text to it ?

I have a Var called (123)
I want to Append to it ?

Thanks in Advance
DB
0
Dinkleburger
Asked:
Dinkleburger
1 Solution
 
freshman3kCommented:
Hello!

Here's how you do it(A function I created):

procedure AppendString(FileName: String; AStr: String);
var
    Stream: TFileStream;
begin
    Stream := TFileStream.Create(FileName, fmOpenWrite);
    Stream.Seek(0,soFromEnd);
    Stream.Write(PChar(AStr),Length(AStr));
    Stream.Free;
end;

Example how to use it:
AppendString('c:\ABC.Dat','123');

Good Luck! :)
0
 
DinkleburgerAuthor Commented:
Thank you for that
thats what i need...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now