Article ID: 42663
Article Last Modified on 11/21/2006
APPLIES TO
- Microsoft QuickBasic 4.0
- Microsoft QuickBASIC 4.0b
- Microsoft QuickBasic 4.5 for MS-DOS
- Microsoft BASIC Compiler 6.0
- Microsoft BASIC Compiler 6.0b
- Microsoft BASIC Professional Development System 7.0
This article was previously published under Q42663
SUMMARY
The two sample programs shown below suppress the automatic forcing of a LineFeed (LF) character that normally follows a Carriage Return (CR) character sent to the printer.
The "LPT1:BIN" device requires a WIDTH#n,255 statement to suppress CR/LF pairs added by Basic after every 80th printable ASCII character. The "LPT1" device doesn't require a WIDTH#n statement.
This information applies to QuickBasic Versions 4.00, 4.00b, and 4.50, to Microsoft Basic Compiler Versions 6.00 and 6.00b, and to Microsoft Basic PDS Version 7.00.
MORE INFORMATION
Example 1, which uses the Basic device name "LPT1", does not require a WIDTH#n statement to suppress extra CR/LF pairs.
Example 2, which uses the Basic device name "LPT1:BIN", requires the statement WIDTH#n,255 to prevent Basic from appending a Carriage Return plus LineFeed (Hex 0A plus Hex 0D) pair to the characters Hex 6F (decimal 111) and Hex BF (decimal 191). (Bytes 111 and 191 are 80 bytes apart. Bytes 0 through 31 at the beginning are not counted in the width.)
To examine printer byte values more easily, the printer should be initialized in Hex dump mode. (On an Epson printer, Hex dump mode is turned on by holding down the Form Feed button while turning on the printer. Refer to your printer manual if your printer differs.)
Code Example
REM **** Program 1 **** OPEN "LPT1" FOR BINARY AS #1 FOR I = 0 TO 255 C$= CHR$(I) PUT #1,,C$ NEXT REM **** Program 2 **** ' Adding WIDTH#1,255 eliminates the CR/LF addition for "LPT1:BIN": OPEN "LPT1:BIN" FOR RANDOM AS #1 ' WIDTH#1,255 ' Required to suppress CR/LF at bytes 111 and 191. FOR I = 0 TO 255 PRINT#1, CHR$(I); NEXT
Additional query words: QuickBas BasicCom
Keywords: KB42663