Q33627: SHELL in QuickBASIC Version 3.00 May Overwrite String Space
Article: Q33627
Product(s): See article
Version(s): 3.00 4.00 4.00b 4.50
Operating System(s): MS-DOS
Keyword(s): ENDUSER | buglist3.00 fixlist4.00 fixlist4.00b fixlist4.50 | mspl13_basic
Last Modified: 16-DEC-1989
The following program incorrectly prints x$(0) as "WExxxxx" instead of
"xxxxxxx" after the SHELL in QuickBASIC Version 3.00. If you do a
FRE("") before the SHELL statement, the problem goes away. The program
runs correctly in QuickBASIC Version 4.00.
Microsoft has confirmed this to be a problem in QuickBASIC Version
3.00 in the editor or when compiled. This problem does not occur in
Microsoft QuickBASIC Versions 4.00, 4.00b, or 4.50 for MS-DOS or in
QBX.EXE which comes with Microsoft BASIC PDS Version 7.00
(fixlist7.00) for MS-DOS and MS OS/2.
The following is a code example:
DECLARE SUB test (y$())
OPEN "temp" FOR RANDOM AS #1 LEN = 10
CLOSE #1
OPEN "temp" FOR RANDOM AS #2 LEN = 1
CLOSE
a$ = CHR$(0) + CHR$(0)
DIM x$(dumb)
x$(0) = "xxxxxxx"
CALL test(x$())
SUB test (y$()) STATIC
PRINT y$(0) 'prints "xxxxxxx".
'p = fre(""): p=fre(-1)
SHELL
PRINT y$(0) 'prints "WExxxxx".
END SUB
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.