Environment versions
Network:
Windows 2003 Server
>>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only