Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Low level file functions to get the number of lines
Message
De
22/07/1997 17:49:20
 
 
À
22/07/1997 17:17:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00041205
Message ID:
00041218
Vues:
36
>>I think in the help of FP 2.5, if you issue FREAD(lnHandle, 254), this will read to the end of the line. So if you code:
>>
>>lnHandle=fopen("MyTextFile.txt")
>>=fseek(lnHandle,0) && moves to beginning of file.
>>lnLines=0
>>do while !feof(lnHandle)
>> =fread(lnHandle, 254)
>> lnLines=lnLines+1
>>enddo
>>=fclose(lnHandle)
>>return lnLines
>
>Yes, but this will require a scan of the file.
>
>BTW, after a FOPEN(), aren't we at the beginning of the file?

If you know the length of the record (which you should) take the size of the incoming file and divide it by the record length. This will give you # of records.
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform