Microsoft KB Archive/72718

= CTRL+BREAK Does Not Abort Basic PDS's INKEY$ If No BC /D =

Article ID: 72718

Article Last Modified on 10/20/2003

-

APPLIES TO


 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q72718



SUMMARY
If you compile without the BC /D (debug) option in Basic PDS versions 7.0 and 7.1, pressing CTRL+BREAK will cause the INKEY$ function to return two null bytes and program execution will continue without breaking. In contrast, when compiled with BC /D, or run in QBX.EXE, an INKEY$ loop will not input CTRL+BREAK, and CTRL+BREAK will abort the program (unless trapped with ON KEY GOSUB key-trapping statements).

This information applies to Microsoft Basic Professional Development System (PDS) versions 7.0 and 7.1 for MS-DOS and MS OS/2.

In versions of Basic earlier than 7.0, the INKEY$ function never returns bytes for CTRL+BREAK, and CTRL+BREAK always aborts the program (unless trapped with ON KEY GOSUB key-trapping statements).



MORE INFORMATION
The following code example demonstrates this. CLS PRINT &quot;press CTRL+BREAK...&quot; WHILE a$ = &quot;&quot; a$ = INKEY$ WEND PRINT &quot;length=&quot;; LEN(a$); &quot;byte values=&quot;;ASC(a$); ASC(RIGHT$(a$, 1)) PRINT &quot;This will print without BC /D, but not with BC /D or QBX.EXE&quot; END Compile the code example both with and without the BC /D option for comparison. Without the /D option, the CTRL+BREAK keystroke is passed on to the program and execution continues, so the two PRINT statements after the LOOP will be printed. When compiled with BC /D, or run in QBX.EXE, or compiled with Basics earlier than 7.0, the program halts execution and the PRINT statements are never executed.

Additional query words: BasicCom

Keywords: KB72718

-

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

© Microsoft Corporation. All rights reserved.