Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reading plaintext?
Message
From
22/11/2008 09:42:36
 
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Miscellaneous
Thread ID:
01363610
Message ID:
01363648
Views:
12
>>I was asked for help with a toy project - read in a plaintext file and return a random line from the file. I could do this easily with a table, but don't know enough about low level file functions to do that job easily. Can I get a kick in the right direction, please?
>
>Hi Chris,
>
>If the file has less than 65000 record (VFP array limit befor VFP9), you can use FILETOSTR() and ALINES(). Otherwise you'll have to use FOPEN(), FGET() and FCLOSE().

What constitutes a line? Is this from the start of a sentence? Or is it when a CRLF is encountered? You can use FILETOSTR() as suggested by Sergey and then use STREXTRACT() to parse the contents based on a line definition. You could parse into an array or into a table memo field. ALINES() also has capability to parse, but it is limited in array size for VFP8 and prior.
Previous
Reply
Map
View

Click here to load this message in the networking platform