LPRINT CLOSE statement   

Purpose

Disconnect the current printer device.

Syntax

LPRINT CLOSE

Remarks

LPRINT CLOSE detaches the currently selected printer connection (established with the LPRINT ATTACH statement) from LPRINT operations, allowing the spooler subsystem to commence print operations.  Once a connection is closed, LPRINT$ will return an empty printer device name string until a new connection is established.

LPRINT CLOSE is equivalent to using LPRINT ATTACH with an empty printer device name string.

Restrictions

LPRINT CLOSE is an essential step in the print process.  To ensure the printer device is available to other applications, printers should always be closed when not in use.  Failing to close a connection may cause significant delays before printing commences.  In some cases, some or all of the print data may be lost.

See also

LPRINT, LPRINT ATTACH, LPRINT FLUSH, LPRINT FORMFEED, LPRINT$, XPRINT, XPRINT ATTACH

Example

' Typical LPRINT printing strategy

ERRCLEAR

LPRINT ATTACH "LPT2" ' Use LPT2 device

IF ISTRUE ERR OR ISFALSE LEN(LPRINT$) THEN

  LPRINT "This is your line-printer talking"

  LPRINT FORMFEED      ' Issue a formfeed

  LPRINT FLUSH         ' flush the buffer

  LPRINT CLOSE     ' detach the printer

END IF