Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Low level file functions -counting lines of code in prop
Message
De
15/05/1998 15:24:35
 
 
À
15/05/1998 14:45:54
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00099818
Message ID:
00099838
Vues:
23
Don't forget the && too!

Cheers,
Jim N

>>Hello:
>>I'm writing a program to count the lines of code in my programs.
>>I need to be able the count the lines of code without including the comments and blank spaces. Any ideas on how to do this? THis is the code that I'm using that returns the total number of lines including comments.
>>gnfilehandle = fopen("mainlib.prg")
>>nsize = fseek(gnfilehandle,0,2)
>>if nsize <= 0
>>wait window "this file is empty!" nowait
>>else
>>=fseek(gnfilehandle, 0)
>>lctext = fread(gnfilehandle, nsize)
>>lnlines = occurs(chr(13), lctext)
>>? lnlines
>>endif
>>
>>This works and returns total number of lines. Any suggestions would be greatly appreciated.
>
>This strict requirement will force you to analyze each line separately, i.e. you should FOPEN() the file loop through it DO WHILE NOT FEOF() retrieving cString=ALLTRIM(FGETS()). In cString you should filter CASEs when EMPTY((cString)) or LEFT(cString,1)="*" or RIGHT(cString1)=";"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform