How Would I go about:

1) Counting the number of lines in a text file
2) Counting the number of words in a text file.

I know that I have to Use AssignFile(), and many other file operators, I just don't know how to do this.

Any help would be much appreciated!!

Thanks

Greg

How Would I go about:

1) Counting the number of lines in a text file
2) Counting the number of words in a text file.

I know that I have to Use AssignFile(), and many other file operators, I just don't know how to do this.

Any help would be much appreciated!!

Thanks

Greg

var
      fileData : TStringList;
      lines : Integer;
 begin
      fileData := TStringList.Create;       
      fileData.LoadFromFile('Test.txt');  
      lines := fileData.Count;

Line count, have no idea on how to count the words

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.