Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi, I want to know if ther

Status
Not open for further replies.

mitch77

Programmer
Nov 16, 2000
42
0
0
PT
Hi,

I want to know if there is any method or property of an object, to count the number of lines in a file.
If not, please give me an idea how to do it.

But i have another question, how can i directly read the last line of a file??

Thanks,Mitch
 
Hi.

Here is an example to read the last line of a text file:

<Script Language=&quot;JavaScript&quot;>
var ff=new ActiveXObject(&quot;Scripting.FileSystemObject&quot;);
var lastLine;
function readT()
{
var fo=ff.OpenTextFile(&quot;f:\\mytxt.txt&quot;);
while(fo.AtEndOfStream == 0)
{
lastLine=fo.ReadLine();
}
}
</Script>


regards, Kirilla
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top