Borland C++ reference

_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

DOSUNIXWindowsANSI CC++ 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_WRITEPrints the character in abyte. The value of abyte can be 0 to 255.
PRINTERINITInitializes the printer port. The abyte argument is ignored.
PRINTERSTATUSReads 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:

BitO0x01Device time out
Bits0x08I/O error
Bit 40x10Selected
Bits0x20Out of paper
Bit 60x40Acknowledge
Bit 70x80Not 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.