Solved

Append to file or Var

Posted on 2002-04-19
2
270 Views
Last Modified: 2013-11-18
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
Comment
Question by:Dinkleburger
2 Comments
 
LVL 2

Accepted Solution

by:
freshman3k earned 25 total points
ID: 6955226
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
 

Author Comment

by:Dinkleburger
ID: 6956281
Thank you for that
thats what i need...
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now