Microsoft KB Archive/69845

= LPRINT with &quot;;&quot; Prints Nothing Until 80-Byte Buffer Is Full =

Article ID: 69845

Article Last Modified on 8/16/2005

-

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
 * Microsoft BASIC Professional Development System 7.1
 * Microsoft GW-BASIC Interpreter 3.20
 * Microsoft GW-BASIC Interpreter 3.22
 * Microsoft GW-BASIC Interpreter 3.23

-



This article was previously published under Q69845



SUMMARY
If a semicolon terminates the LPRINT statement, thus concatenating subsequent LPRINT output onto the same line, then the printer will not print the line until the contents of the printer buffer exceeds 80 characters (one line) or until the printer receives a carriage return plus linefeed (CR+LF) sequence.

This is an expected behavior of LPRINT because the printer is waiting for a CR+LF, which LPRINT's semicolon suppresses.



MORE INFORMATION
The following example demonstrates the problem:

Step 1:

LPRINT &quot;BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB&quot;; LPRINT &quot;BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB&quot;; This will cause the printer to print nothing. Add the following line of code to the above code:

Step 2: LPRINT &quot;CC&quot; Of these last two characters (&quot;CC&quot;), the first character will be enough to fill the line buffer in the printer. The printer will then print what is in its buffer (that is, all the &quot;B&quot;s and the first &quot;C&quot; character). The second &quot;C&quot; character will be held as the first character in the next line in the buffer.

The result is the same no matter how these two steps are performed: they could be contiguous lines in a program; step 1 could be in a main module and step 2 in a subprogram module; or both step 1 and step 2 could be in separate .EXE files. The result is still the same.

If only the step 1 existed in a program and then the program stopped, no output would print until another program was run that sent output to the printer.

Note that turning off the printer clears the buffer. Ending the program does not clear or dump the printer buffer.

Additional query words: QuickBas BasicCom

Keywords: KB69845

-

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

© Microsoft Corporation. All rights reserved.