Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
String is too long to fit (Error 1903)
Message
 
 
À
11/06/2004 13:49:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00912821
Message ID:
00912824
Vues:
12
It's documented in the help under Visual FoxPro System Capacities
"Maximum # of characters per character string or memory variable is 16,777,184"

>This, to me, is a wierd behaviour.
>
>OK, let's say I try the following line of code:
>mystr = SPACE(20000000)
>
>It fails and I get the message 'String is too long to fit'. I'm exceeding some kind of capacity it would seem. By trial and error, I found out that the maximum length for a tring is 16777184 (32 bytes under 2^24 which is 16777216).
>
>Alright. My problem is that the function FILETOSTR will enable much bigger strings. For example, a file with 40 million characters will fit in a string using a call such as:
>
>myhugestr = FILETOSTR("C:\hugefile.txt")
>
>This, to me, is a bug! A string should have the same behaviour no matter how it is assigned.
>
>Anyway, another problem here is that if I have a huge string with more than 16777184 characters taken from file, I cannot append it to another string afterwards because I will, again, go over the limit. So something like this will not work:
>
>mystr = SPACE(20)
>myhugestr = FILETOSTR("C:\hugefile.txt") &&File with 40 million chars
>mynewstr = mystr + myhugestr
>
>I'll get the 'String is too long to fit' error at line 3 when I try to append both strings. I can't put it's content in another string variable if it exceeds the limit. This means that a call that returns more than 16777184 characters will always fail and not just for appends but other operations/functions too.
>
>Basically, I'm wondering if this is 'normal' or if I'm doing something wrong? At first, I thought that the maximum string length could be set using a 'SET' or 'SYS' command but I couldn't find any. So, if huge strings can be imported from a file, how can I maintain that behaviour (or property) in other cases?
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform