KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q27385: LINE INPUT to Fixed-Length String Crashes QB.EXE Interpreter

Article: Q27385
Product(s): See article
Version(s): 4.00
Operating System(s): MS-DOS
Keyword(s): ENDUSER | ptm37 fixlistbc6.00 buglist4.00 fixlist4.00b fixlist4.50 | mspl13_basic
Last Modified: 7-NOV-1988

Using a fixed-length string to accept input in a LINE INPUT statement
can hang the QB.EXE Interpreter.

Microsoft has confirmed this to be a problem in Version 4.00. This
problem was corrected in QuickBASIC Versions 4.00b and 4.50, and in
the Microsoft BASIC Compiler Version 6.00 for MS-DOS and OS/2.

The following is an example program showing the problem:

   DIM C AS STRING * 10
   LINE INPUT C
   PRINT C

Run the program and type 1 in response to the LINE INPUT. This will
hang QB.EXE.

The workaround for this problem is to LINE INPUT into a
variable-length string and then assign to a fixed-length string.

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.