CHR$(0) PRINTs As Space to Screen; LPRINTs Nothing to Printer (39578)
The information in this article applies to:
- Microsoft QuickBASIC 4.0
- Microsoft QuickBASIC 4.0b
- Microsoft QuickBASIC 4.5
- Microsoft BASIC Compiler for MS-DOS and OS/2 6.0
- Microsoft BASIC Compiler for MS-DOS and OS/2 6.0b
This article was previously published under Q39578 SUMMARY
CHR$(0) (a null byte) is a non-printable character in MS-DOS. However,
the PRINT and PRINT USING statements in Basic print this character as
a space.
Sending CHR$(0) to the following MS-DOS logical device names will
print nothing:
"CONS:"
"LPTn:"
"COMn:"
"SCRN:"
Likewise, printing CHR$(0) with the LPRINT or LPRINT USING statements
sends nothing.
Fixed-length strings are initialized to null bytes. Printing these
fixed-length strings to the screen and to the printer will give
different column alignment. This difference can be circumvented by
using the STRING$() function to initialize the fixed length string
with spaces.
Modification Type: | Minor | Last Reviewed: | 1/8/2003 |
---|
Keywords: | KB39578 |
---|
|