Counting lines in text files

Advertisements

  Top Tutorials     New Tutorials     Submit     Login     Register  

Tutorial Detail

Counting lines in text files

In this sample ASP code, we will read and count the lines in a text file.
http://www.devtutorials.info/articles/8_Counting_lines_in_text_files.asp
  • Total Hits: 10957

  • Average Rating :
    URL RatingURL RatingURL RatingURL RatingURL Rating

  •  

  • Total Votes: 139 votes

  • Category: ASP/File Manipulation

  • Submitted on: 2008-03-06 09:59:19

  • Submitted By: Devesh Khanna

  • Set as Favorite

Description:

In this sample ASP code, we will read and count the lines in a text file. This study uses FileSystem Object and readline method.

Sample Code:

<%

strLine=""�
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(Server.MapPath("404.asp"))
�Do
�� objFile.ReadLine
�� �i = i + 1
������ �Loop Until objFile.AtEndofStream
��objFile.Close
�response.write ("There are "& i &" lines in sample text file.")

%>    More detail...

Rating Detail

 Stars  Percentage  Total Vote
 One star  Vote LeftVote MiddleVote Right 38.85%  54
 Two starsTwo star  Vote LeftVote MiddleVote Right 10.07%  14
 Three starsThree starsThree stars  Vote LeftVote MiddleVote Right 11.51%  16
 Four starsFour starsFour starsFour stars  Vote LeftVote MiddleVote Right 10.79%  15
 Five starsFive starsFive starsFive starsFive stars  Vote LeftVote MiddleVote Right 28.78%  40

Caste Your Vote

 Rating  Selection  Guidelines
 Poor:     Very disappointing, useless.
 Fair:     Below average, disappointing but not useless.
 Good:     About average in its class.
 Very Good:     Above average for its category.
 Excellent:     One of the best Tutorials in its category.





Advertisements
Advertisements