Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FREAD line by line
Message
 
 
À
01/03/2004 14:02:40
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00882109
Message ID:
00882226
Vues:
22
This message has been marked as a message which has helped to the initial question of the thread.
Tracy,

I'll throw one other solution into the mix. That works especially well if your lines are less than 254 characters:

create cursor TheFile ( cLine c(254) )
append from TheFile.txt type sdf

now you can use a scan loop to iterate the file. If the lines can exceed 254 you can put enough fields into your cursor to handle the max length.

This works with files that would cause alines() to hit array size limits. It has the advantage over fgets() in that you can easily manipulate blocks of lines according to commonalities ie scan for "linetype=1" $ cLine. APPEND FROM works amazingly fast.

>I want to read a file line by line. I know that at the end of each line is a chr(13) followed by a chr(10). I typically read in a set number of bytes til I get to the end of a file, but in this case I want to make sure that I readin line by line. Is there an easy way to do that?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform