Solved

How to get the linage of file?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

929 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

10 Experts available now in Live!

Get 1:1 Help Now