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 "Device I/O error" (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 "Device I/O error" occurs.
The following is a code example:
DEFINT A-Z OPEN "COM1:1200,n,8,1,cs0,ds0" FOR RANDOM AS #1 ON COM(1) GOSUB emptycom COM(1) ON FOR i = 1 TO 10000 ' WHILE INKEY$<>"": WEND ' Used to Empty the Keyboard buffer PRINT #1, "a" NEXT i CLOSE END emptycom: ' WHILE INKEY$<>"": 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