LPRINT with ";" Prints Nothing Until 80-Byte Buffer Is Full (69845)



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
  • Microsoft Basic Professional Development System for MS-DOS 7.0
  • Microsoft Basic Professional Development System for MS-DOS 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 "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB";
        LPRINT "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB";
				
This will cause the printer to print nothing. Add the following line of code to the above code:

Step 2:
        LPRINT "CC"
				
Of these last two characters ("CC"), 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 "B"s and the first "C" character). The second "C" 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.

Modification Type:MinorLast Reviewed:8/16/2005
Keywords:KB69845