_bios_printer
raw OCR
Printer I/O using BIOS services directly.
Defined in header <bios.h>
Syntax
#include <bios.h>
unsigned _bios_printer(int cmd, int port, int abyte);
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ |
Remarks
_bios_printer performs various printer functions on the printer identified by the parameter port using BIOS interrupt 0x17.
A port value of 0 corresponds to LPTl; a port value of 1 corresponds to LPT2; and so on.
The value of cmd can be one of the following values (defined in bios.h):
| _PRINTER_WRITE | Prints the character in abyte. The value of abyte can be 0 to 255. |
| PRINTER | INIT | Initializes the printer port. The abyte argument is ignored. |
| PRINTER | STATUS | Reads the printer status. The abyte argument is ignored. |
Return value
The value returned from any of these operations is the current printer status, which is obtained by ORing these bit values together:
| BitO | 0x01 | Device time out |
| Bits | 0x08 | I/O error |
| Bit 4 | 0x10 | Selected |
| Bits | 0x20 | Out of paper |
| Bit 6 | 0x40 | Acknowledge |
| Bit 7 | 0x80 | Not busy |
Example
#include <stdio.h>
#include <conio.h>
#include <bios.h>
int main(void)
unsigned status, abyte = 0;
printf( "Please turn off your printer. Press any key to continue\n") ;
getchO ;
status = _bios_printer(_PRINTER_STATUS, PORTNUM, abyte);
if (status & 0x01)
printf ("Device time out.\n");
if (status & 0x08)
printf("I/0 error.\n");
if (status & 0x10)
printf( "Selected.\n");
if (status & 0x20)
printf("Out of paper.\n");
if (status & 0x40)
printf ("Acknowledge.\n");
if (status & 0x80)
printf ("Not busy.\n");
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/bios.h/_bios_printer/
· short form /3.1/_bios_printer/