OPEN "PRN" can be used to send data to a printer. OPEN will make a connection to the printer using a handle to "PRN", the standard printer communications device. The data then is output to the printer using a PRINT statement. Here is a simple example for sending data to the default printer.
DIM i OPEN "PRN" FOR OUTPUT AS FP1 FOR i = 1 TO 60 PRINT FP1,"This is line number", i NEXT PRINT FP1, CHR$(12) 'CHR$(12) is Form Feed Character CLOSE FP1
LPRINTprints directly only to LPT1. Anything that you can PRINT and FPRINT, you can also LPRINT. The PRINTER OPEN statement must precede LPRINT and PRINTER CLOSE follow to close the printer port.
Syntax:PRINTER OPEN [, FontName AS STRING] _ [, FontSize AS INTEGER] _ [, CharacterSet AS INTEGER] LPRINT comma separated expressions PRINTER CLOSE Parameters:
|
A simple LPRINT demonstration:
PRINTER OPEN FOR INTEGER i = 1 to 50 LPRINT "This is line number ", i , ". BCX matures again!" NEXT LPRINT CHR$(12) ' Form Feed(eject from paper printer) PRINTER CLOSE
The PRINTER EJECTPAGE statement notifies the printer that the application has finished writing to a page. This statement is used to tell the printer to eject the page. The PRINTER OPEN and LPRINT statements must precede PRINTER EJECTPAGE and PRINTER CLOSE follow to close the printer port.
Syntax:PRINTER OPEN LPRINT comma separated expressions PRINTER EJECTPAGE PRINTER CLOSE Parameters:
|
Here is a second method to print to a printer. BCX opens a connection to the printer using a handle to PRN, a standard printer communications device. The data then is output to the printer using a PRINT statement. LPT1 should also work instead of PRN.
Here is a simple example for sending data to the default printer.
DIM i OPEN "PRN" FOR OUTPUT AS FP1 FOR i = 1 TO 60 PRINT #FP1, "This is line number" , i NEXT PRINT #FP1, CHR$(12) 'CHR$(12) is Form Feed Character CLOSE FP1