KnowledgeBase Archive

An Archive of Early Microsoft KnowledgeBase Articles

View on GitHub

Q64108: GET from COM1 or COM2 Fails to Get Correct Data – Use INPUT$

Article: Q64108
Product(s): See article
Version(s): 7.00 7.10 | 7.00 7.10
Operating System(s): MS-DOS | OS/2
Keyword(s): ENDUSER | SR# S900710-87 buglist7.00 buglist7.10 | mspl13_basic
Last Modified: 1-AUG-1990

The GET statement fails to read the correct information from a
communications port (COM1, COM2) with Microsoft BASIC Professional
Development System (PDS) version 7.00. Characters are removed from the
buffer, but the values read in are not the correct values sent across
the port.

To work around this problem, use the INPUT$ function to read the data
from the COM port.

Microsoft has confirmed this to be a problem with Microsoft BASIC PDS
versions 7.00 and 7.10 for MS-DOS and OS/2. We are researching this
problem and will post new information here as it becomes available.

This problem does NOT occur in Microsoft QuickBASIC version 4.50 or
earlier or in Microsoft BASIC Compiler version 6.00b or earlier.

Code Example
------------

The following program attempts to read characters from COM1 using both
GET and INPUT$:

   DIM a AS STRING * 1, b AS STRING * 1
   OPEN "COM1:300,n,8,1" FOR RANDOM AS #1
   GET #1, , a
   b = INPUT$(1, 1)
   PRINT a, b
   END

In QuickBASIC 4.50, both the GET and INPUT$ statements return the
correct values, but in BASIC PDS 7.00 and 7.10, only INPUT$ returns
the correct data while GET returns meaningless data.

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.