Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Max Length of a sting in VFP ?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00537774
Message ID:
00537875
Views:
13
Rock,

Despite what help says a string length is limited by memory. Functions that create strings have 16mb limits. I've read a 64mb file into a string and manipulated it on a 256 mb machine. If you exceed available RAM be prepared for very slow and intense disk swapping.
lcX = replicate( "abcde12345", 1024*103 ) && about 1 mb
for i = 1 to 6 && 6 = 32mb, 7 = 64 mb
   ? len( lcX ), occurs( "a", lcX )
   lcX = lcX + lcX && double the length
endfor
This 64 mb notebook (I had VFP, OE and IE running) starts swapping to disk after the 16mb string so I killed it. If you have more memory you could test bigger strings.

>Do you know what's the maximum length of a string in Fox ?
>
>I Tried
>
>x = replicate("a",20*1024*1024) && 20 Meg...
>
>it always returns me (String to long to fit...)
>
>Do you think that it's a memory limitation ?
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Reply
Map
View

Click here to load this message in the networking platform