Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
FREAD() etc...
Message
De
06/08/2007 11:32:32
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
06/08/2007 11:07:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01246151
Message ID:
01246155
Vues:
21
>It has to happen in everyone's life I guess, and today is my turn. I need to use FREAD() to read each line of a text file into a character variable. Each line in the file is a different length. How do I use FREAD() to add a variable length line to a char var, and move to the beginning of the next line in the file?
>
>Many thanks for the help!

As Nadya points out, fgets() will read an entire line, while fread() is designed will read a fixed number of bytes.

An interesting alternative to LLFF is to read the entire file with FileToStr(), and convert it to an array - one array element per line - with the function alines(). However, this is limited by the size of arrays (65,000 elements / lines, up to VFP version 8).
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform