Link to home
Start Free TrialLog in
Avatar of cdc_sickle
cdc_sickle

asked on

Adding text to file...

I know how to add text to an existing fine, except it adds it to the end. How do I add it to the beginning of the file??
Avatar of jhurst
jhurst

There is no direct way to do it, sadly
ASKER CERTIFIED SOLUTION
Avatar of jhurst
jhurst

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ozo
perldoc -q append
another way....

Crude, but hey it works!!!

Stick an invisble memo onto your form, so the user can not see whats happening.... and do this..

memo1.lines.loadfromfile('c:\autoexec.bat');
memo1.lines.insert(0,'rem Hello');
memo1.lines.insert(1,'rem craig');
memo1.lines.insert(2,'rem was');
memo1.lines.insert(3,'rem here');
memo1.lines.savetofile('c:\autoexec.bat');


Stick it somewhere.... And thats the easiest way of doing it!....

Craig C. Jhurst, un Comment it as an Answer!

SOOOOOOOORRRRRRRRRYYYYYY, thought i was in the Delphi section still.....  i really am sorry
Avatar of cdc_sickle

ASKER

Jhurst, that is exactly how i panned on having to do it. Ill see if it works!
This worked, with a little touching up!