Solved

How to get the linage of file?

Posted on 2000-03-23
2
128 Views
Last Modified: 2010-04-04
I want to get the linage of a Text file.
Besides Use ReadLn to sum the linage, Has a simply way or function to get it.

thanks
kelvin
0
Comment
Question by:kelvinyu
2 Comments
 

Accepted Solution

by:
vinnair earned 50 total points
ID: 2652183
I assume linage means the number of lines.

You can use the Tstringlist class to good effect.
Do the following:

function getnolines(filename: string): integer;
var
  Mylist: TStringList;
begin
  MyList := TStringList.Create;
  MyList.LoadFromFile(filename);
  Result := MyList.Count;
  MyList.Free;
end;

This piece of code is enough. This is one of the simplest way to work with text files.
0
 

Author Comment

by:kelvinyu
ID: 2659399
it's better than count the linage one by one

Thanks
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

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

18 Experts available now in Live!

Get 1:1 Help Now