Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
String is too long to fit (Error 1903)
Message
From
11/06/2004 14:08:27
 
 
To
11/06/2004 13:49:08
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00912821
Message ID:
00912834
Views:
16
Your solution will depend on what you need. Sometimes you mus use low level functions, sometimes you can simply APPEND into a table. I use the following approach frequently:
CREATE CURSUR TEMP (MYTEXT C(250))
APPEND FROM mylongfile SDF
Then I use VFP to process the cursor.

>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?
>
>Thanks a million,
>
>SC
Previous
Reply
Map
View

Click here to load this message in the networking platform