Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Count # of lines in a Textfile FAST !
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01347163
Message ID:
01347170
Views:
18
This message has been marked as the solution to the initial question of the thread.
See http://www.berezniker.com/content/pages/visual-foxpro/counting-lines-ascii-file

>
>Any quick way to Count the number of Lines in a Text File?
>
>I have some data coming in a delimited textfile. Each line represents a normal record.
>
>What I did was to open the file, and loop through each line of data and keep track of how many times this was done until I reach the end of the file.... like this...
>
>
>*Count the number of records in the file...
>     lnNumOfRecords = 0
>     DO WHILE !FEOF(lnHandle)
>          lcText = ALLTRIM(FGETS(lnHandle))
>          lnNumOfRecords = lnNumOfRecords + 1
>     ENDDO
>     filetop  = FSEEK(lnHandle, 0)				&& Move pointer to BOF
>
>
>
>Kinda slow with a LARGE file....
>
>I needed to know how many lines, because with this known, I can then use this info in a Thermometer when I REALLY process the text file.
>
>Thanks!
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform