Microsoft KB Archive/77877

= BUG: When Compiled, PRINT CHR$(0) Incorrectly Concatenates =

Article ID: 77877

Article Last Modified on 11/21/2006



This article was previously published under Q77877



SYMPTOMS
Below is an example where the null character, CHR$(0), in a PRINT statement causes incorrectly concatenated output in a compiled program. The problem does not occur in interpreted programs.

Microsoft has confirmed this problem in the compiler in Microsoft QuickBasic versions 1.0, 1.0a, and 1.0b for Macintosh.



MORE INFORMATION
In the code example below, the output correctly appears on two separate lines in the interpreter in QuickBasic. However, from the compiled version of the program, the output incorrectly prints on the same line.   A$ = CHR$(0) PRINT &quot;Hi&quot;; A$  PRINT &quot;Bye&quot;; A$   INPUT J When run in the QuickBasic environment, the correct output appears as:   Hi   Bye ? When compiled, however, the following incorrect output results:   HiBye? The CHR$(0) is ignored by the compiler, causing output to continue on the same line, as if the PRINT statement ended in a semicolon. If A$ is changed to any other ASCII character (such as CHR$(64), the @ character) the compiled code runs correctly, with the output appearing on two separate lines.

Additional query words: MQuickB 1.00 1.00a 1.00b

Keywords: kbbug KB77877

-

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

© Microsoft Corporation. All rights reserved.