FIX: Strings Stored in MEM Files Limited To 64K (297767)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 3.0
  • Microsoft Visual FoxPro for Windows 3.0b
  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Windows 5.0a
  • Microsoft Visual FoxPro for Windows 6.0

This article was previously published under Q297767

SYMPTOMS

When you use the SAVE TO command to store a string larger than 64KB to a variable save (.mem) file, you may receive an error message when you restore the string.

STATUS

This problem was corrected in Microsoft Visual FoxPro version 7.0 for Windows.

MORE INFORMATION

To reproduce the problem, run the following code in Visual FoxPro (VFP).
*!* Q297767: FIX: Strings Stored in MEM Files Limited To 64KB
*!* This code demonstrates the problem.

SET SAFETY OFF

* First attempt with less than 64 KB.
aTest = REPLICATE(" ", 65534)
SAVE TO LongStr.MEM ALL LIKE aTest
RESTORE FROM LongStr.MEM

* Second attempt with more than 64 KB.
aTest = REPLICATE(" ", 65536)
SAVE TO LongStr.MEM ALL LIKE aTest
RESTORE FROM LongStr.MEM
				
The first part of this code executes correctly in all versions of VFP, because the string is under 64K.

When you run the second part of the code in VFP version 6.0, you receive the following error message:
Memory file is invalid.
Other versions of VFP produce slightly different messages.

If you replace the space in the REPLICATE function with an "A" in VFP 6.0, you receive the following error message:
Too many variables.

Modification Type:MajorLast Reviewed:5/12/2003
Keywords:kbBug kbCodeSnippet kbfix KB297767