Microsoft KB Archive/297767

From BetaArchive Wiki
Knowledge Base


FIX: Strings Stored in MEM Files Limited To 64K

Article ID: 297767

Article Last Modified on 5/12/2003



APPLIES TO

  • Microsoft Visual FoxPro 3.0 Standard Edition
  • Microsoft Visual FoxPro 3.0b Standard Edition
  • Microsoft Visual FoxPro 5.0 Standard Edition
  • Microsoft Visual FoxPro 5.0a
  • Microsoft Visual FoxPro 6.0 Professional Edition



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.

Keywords: kbbug kbfix kbcodesnippet KB297767