Solved

How to get the linage of file?

Posted on 2000-03-23
2
132 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

860 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