Microsoft KB Archive/37306

= &quot;Device I/O Error&quot; If Keyboard Buffer Filled During &quot;COM1&quot; =

Article ID: 37306

Article Last Modified on 11/21/2006



This article was previously published under Q37306



SYMPTOMS
When the keyboard buffer becomes full while serial communications are executing, a &quot;Device I/O error&quot; (error 57) may occur.



STATUS
Microsoft has confirmed this to be a bug in QuickBasic versions 4.00, 4.00b, and 4.50, in Microsoft Basic Compiler versions 6.00 and 6.00b for MS-DOS and MS OS/2 (buglist6.00, buglist6.00b), and in Microsoft Basic Professional Development System (PDS) version 7.00 for MS-DOS and MS OS/2 (buglist7.00). This problem was corrected in Basic PDS version 7.10 (fixlist7.10).

To work around this problem, use the INKEY$ function to poll the keyboard so that any keyboard input will be flushed. This process is shown below.



MORE INFORMATION
When the program code example below is run without any keyboard interference, the program runs to completion. However, if you type enough to fill the keyboard buffer, a &quot;Device I/O error&quot; occurs.

The following is a code example: DEFINT A-Z OPEN &quot;COM1:1200,n,8,1,cs0,ds0&quot; FOR RANDOM AS #1 ON COM(1) GOSUB emptycom COM(1) ON  FOR i = 1 TO 10000 ' WHILE INKEY$<>&quot;&quot;: WEND   ' Used to Empty the Keyboard buffer PRINT #1, &quot;a&quot; NEXT i  CLOSE END

emptycom: ' WHILE INKEY$<>&quot;&quot;: WEND  '  Used to Empty the Keyboard buffer INPUT #1, s$    PRINT s$, RETURN

Additional query words: QuickBas BasicCom B_BasicCom buglist4.00 buglist4.00b buglist4.50

Keywords: KB37306

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.