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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to find # of lines in txt file

Status
Not open for further replies.

THEMAN101

Programmer
Apr 29, 2003
44
US
i have a text file that i want to get info from.
How do i find how many lines are in the text file.
 
Simple...
OPEN "TEXT1.TXT" FOR INPUT AS #1
DO
LINE INPUT #1, A$

'IF YOU DON'T WANT TO COUNT A BLANK LINE THEN UNREM THE
'CODE BELOW.
'IF LTRIM$(RTRIM$(A$))<>&quot;&quot; THEN

C0UNT% = COUNT% + 1
'END IF
LOOP UNTIL EOF(1)
PRINT &quot;NO. OF LINES IN THIS TEXT FILE IS &quot; + LTRIM$(STR$(COUNT%))
CLOSE #1
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top