Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FREAD() etc...
Message
From
06/08/2007 11:32:32
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
06/08/2007 11:07:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01246151
Message ID:
01246155
Views:
20
>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)
Previous
Reply
Map
View

Click here to load this message in the networking platform