GET from COM1 or COM2 Fails to Get Correct Data -- Use INPUT$ (64108)



The information in this article applies to:

  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.0
  • Microsoft Basic Professional Development System (PDS) for MS-DOS and MS OS/2 7.1

This article was previously published under Q64108

SYMPTOMS

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.

WORKAROUND

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

STATUS

Microsoft has confirmed this to be a bug in 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 in the Microsoft Knowledge Base 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.

MORE INFORMATION

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 version 4.50, both the GET and INPUT$ statements return the correct values, but in Basic PDS versions 7.00 and 7.10, only INPUT$ returns the correct data while GET returns meaningless data.

Modification Type:MajorLast Reviewed:10/20/2003
Keywords:KB64108