create file ( log.txt )

hello and thank you for looking at this question

i like to create a new file called log.txt , maybe create an empty file but i will be happy if i get code for that and create with some text to

Lulli
lulliAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rwilson032697Commented:
Try this:

var
  f : Text;

....
AssignFile(f, 'log.txt');
rewrite(f);
Writeln(f, 'Boo!');
CloseFile(f);

CHeers,

Raymond.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lulliAuthor Commented:
Well done , thanks
0
lulliAuthor Commented:
Well done , thanks
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

lulliAuthor Commented:
sorry, how can you do search in the text file?
0
rwilson032697Commented:
It depends what you are searching for.

Can you give me more information?

Cheers,

Raymond.
0
lulliAuthor Commented:
search for a text in the file using "pos" i think
0
lulliAuthor Commented:
search for a text in the file using "pos" i think
0
lulliAuthor Commented:
i only want to search text in the file, thanks
0
rwilson032697Commented:
You can do something like this

var
  f : text;
  s : string;

assignfile(f, 'fred.txt');
reset(f);
try
  while not eof(f) do
    begin
      readln(s);
      if pos('The string to find', s) > 0 then
        begin
          ShowMessage('Found it!');
          Exit;
        end;
    end;
finally
  closefile(f);
end;

Cheers,

Raymond.
0
lulliAuthor Commented:
i get IO error at line i think

readln(s);
0
rwilson032697Commented:
Oops,

try:

      readln(f, s);

Cheers,
Raymond.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.