Device 5 Details

Top  Previous  Next

The device channel 5 provides raw, unfiltered access to any attached or networked printer on your computer. This is useful for sending special codes such as Escape-sequences to a printer. It can also can be used to circumvent the normal driver filtering process and send raw ASCII characters to a printer.




OpenI. Using the OpenI intrinsic on device 5 causes the program to display the standard printer configuration dialog box that lets you select and configure a printer for output. If the user presses the Cancel button, EXPL will generate an I/O error that can be trapped to abort the print operation.


OpenO. Using the OpenO intrinsic on device 5 flushes its output buffer and opens a channel to the currently selected printer.


Output. Any output to device 5 sends characters to the printer buffer. For example, Text(5,"Hello World") sends the string "Hello World" to the print buffer. Printing doesn't begin until the print channel is closed. The output routines handle carriage returns, line feeds, tabs and form feeds.


Close. The Close intrinsic sends any accumulated text in the output buffer to the printer and closes the printer.


Click here for an example printing program.