INPUT Receives Nonzero Value When "&" Character Is Input (30402)






This article was previously published under Q30402

SYMPTOMS

When you INPUT the ampersand (&) character into a numeric variable, the value input is nonzero. This result occurs in QuickBasic Versions 4.00, 4.00b, and 4.50, and in Microsoft Basic Compiler Versions 6.00 and 6.00b for MS-DOS and MS OS/2.

Receiving the ampersand character in an INPUT statement should return zero, because the ampersand character denotes a long-integer constant. However, this character does not return zero.

STATUS

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

MORE INFORMATION

In the QB.EXE environment, a value of 203 is received when the ampersand character is INPUT. When running the same program from an EXE file, the value 233 is received. In an EXE program compiled with Microsoft Basic Compiler Versions 6.00 and 6.00b, the value 259 is received.

The INPUT statement correctly inputs a zero into a numeric variable when you input the ampersand character in QuickBasic Version 3.00, or in Basic PDS 7.00.

The following is a code example:
   INPUT "Enter an integer : ", I%     ' Type in & character.
   PRINT I%
				

Modification Type: Minor Last Reviewed: 1/9/2003
Keywords: KB30402