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?
 
rwilson032697Connect With a Mentor Commented:
Try this:

var
  f : Text;

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

CHeers,

Raymond.
0
 
lulliAuthor Commented:
Well done , thanks
0
 
lulliAuthor Commented:
Well done , thanks
0
Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

 
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
All Courses

From novice to tech pro — start learning today.