Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Counting lines in an ascii file
Message
De
18/03/2004 11:27:07
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00887345
Message ID:
00887540
Vues:
11
Thanks - you should have gotten 9 stars. All three work just fine.

Gaylen

>>I have a ascii text file and need to know the number of lines. What is the best way to count the lines programtically. I know I can use type file to xxxx number and look at the number on the last line but I would like to do it programatically.
>>
>>Thanks
>>Gaylen
>
>There're a few ways to do that.
* #1
>CREATE CURSOR test (C(1))
>APPEND FROM (lcAsciiFileName) TYPE SDF
>lnRecCount = _TALLY
>USE IN temp
>
>* # 2 - would return 1 for empty file
>lnRecCount = 0
>lnFH = FOPEN(lcAsciiFileName)
>DO WHILE NOT FEOF(lnFH)
>  = FGET(lnFH, 8192)
>  lnRecCount = lnRecCount + 1
>ENDDO
>
>* # 3 for a file with 65,000 or less lines
>lnRecCount = ALINES(laTemp, FILETOSTR(lcAsciiFileName))
>RELEASE laTemp
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform