Writes text to the default printer.
Syntax
LPrint [ Using formatstring,] [expressionlist] [(, | ;)] ...
Parameters
formatstring
String specifying the output format.
expressionlist
List of variables to output according to the specified format.
Description
Prints
expressionlist to the printer attached to the parallel port LPT1, or if it does not exist, to the default printer. To print to a printer different from the default one, use
Open Lpt.
The
Using clause formats
expressionlist according to
formatstring. Any data type but a UDT can be passed to
LPrint expressionlist, expressions do
not have to be converted to strings first.
Using a comma (
,) as separator or in the end of the
expressionlist will place the cursor in the next column (every 14 characters), using a semi-colon (
;) won't move the cursor. If neither of them are used in the end of the
expressionlist, then a new-line will be printed.
Some printers will not print at all until a
Chr(12) (End of Page) character is printed.
Internally, FreeBASIC uses the special file number
-1 for printing using
LPrint. This file number may be safely closed using
Close -1. The next use of
LPrint will automatically reopen it as needed.
Example
'' Compile with -lang fblite or qb
#lang "fblite"
'' new-line
LPrint "Hello World!"
'' no new-line
LPrint "Hello"; "World"; "!";
LPrint
'' column separator
LPrint "Hello!", "World!"
'' end of page
LPrint Chr$(12)
Differences from QB
Dialect Differences
- LPrint is not supported in the -lang fb dialect. In this dialect the printer must be properly opened with Open Lpt and Print # must be used to print.
See also