Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
VFP6 Tip-o-the-day STRTOFILE() FILETOSTR()
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00122710
Message ID:
00122729
Vues:
183
>Gary,
>
>Well, string variables aren't really limited to 255 characters in VFP5. For instance, cTest=REPLICATE('X',500) will work fine. The problem is that if you say cTest='xxx...' with more than 255 characters in the string you get an error. I tried this in VFP 6 and got a different error ("Command contains unrecognized phrase/keyword" instead of "Syntax error"). Not much progress there.
>
>You can certainly use FILETOSTR() and STRTOFILE() with larger strings. I just succsessfully used FILETOSTR() with a 20K text file.
>
>>Cool! Are string variables limited to 255 characters in VFP6 as they have been in previous versions?
>>
>>>Folks,
>>>
>>>Have you ever needed to write a character string to a file, or read a file into a character string. Perhaps you used a memo field to hanlde the requirement. In VFP6 you can use the STRTOFILE() function to write a character string to a file, or append it to one. The FILETOSTR() function reads a file and stores the contents into a string variable.
----------------
From the VFP 5 Help: Contents - Technical Reference - Visual FoxPro System Capacities - Other Capacities
"Maximum # of characters per character string 2 gigabytes"

FWIW - I have read in 21,756K of text file into a string. BUT, if you do that...divide it up into smaller chunks for faster processing. When you're dealing with string data of this size you get to find out how many functions process the string 1 character at a time...and it seems the all start from the beginning...
I found it worth the time to divide the string into chunks and then make sure I handled the boundaries correctly. The difference in speed "seemed" exponential.....but don't quote me on that. :> - emphasis on the word "seemed" :>
Rick Liebespach
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform