"String Space Corrupt" with User TYPE Array > 64K in QB.EXE (78890)






This article was previously published under Q78890

SYMPTOMS

When executed inside the QB.EXE editor, the program below produces a "String Space Corrupt" error message, then drops to MS-DOS. This problem occurs when trying to access the last byte of data in the first 64K segment of the user defined array, and when the last field in the user defined type is of odd length.

STATUS

Microsoft has confirmed this to be a bug in QuickBasic version 4.5 (buglist4.50) for MS-DOS. This problem was corrected in Microsoft Basic Professional Development System (PDS) version 7.1 for MS-DOS (fixlist7.10).

MORE INFORMATION

This problem only occurs when the program is run from the QB.EXE environment. To work around this problem, run the program as a compiled application, or change the last field in the user-defined TYPE to an even length.

Note that if the overall size of this array is greater than 128K, the length of the user defined type must be a power of 2. For more information on this topic, query on the following words:

Range and Array and Heap and Gaps and 128K

The following is an example illustrating the problem. Note that QB.EXE must be invoked using the /AH option, which supports arrays larger than 64K:
TYPE RecType
   a AS STRING * 33        ' Change to ... STRING * 34 for workaround
   b AS STRING * 31        ' change to ... STRING * 30 for workaround
END TYPE

' $DYNAMIC
DIM x(1 TO 1025) AS RecType
PRINT x(1024).b
END
				

Modification Type: Minor Last Reviewed: 1/8/2003
Keywords: KB78890