Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How get the Number of Lines from a text file
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00451983
Message ID:
00452070
Views:
53
Nadya,

Try the following;
* Create ~25MB text file
for x = 1 to 400
	strtofile(replicate("X",65000) + chr(13) + chr(10),"txtfile.txt",.t.)
Endfor

lnTotal = 0
FOR x = 1 to 100
	lnStart = seconds()
	lcStr = filetostr("txtfile.txt")
	lnCnt = occurs(CHR(13),lcStr)
	lnEnd = seconds()
	lnTotal = lnTotal + (lnEnd - lnStart)
ENDFOR
?lnTotal/100

Average time to complete: 5.3180 seconds
PIII 500 128MB RAM
Previous
Reply
Map
View

Click here to load this message in the networking platform