C Programming :
Function : biosprint
Example Portability
Syntax
#include <bios.h>
int biosprint(int cmd, int abyte, int port);
Description
biosprint performs various printer functions on the printer identified by the parameter port using BIOS interrupt 0x17.
A port value of 0 corresponds to LPT1; a port value of 1 corresponds to LPT2; and so on.
The value of cmd can be one of the following:
0 Prints the character in abyte.
1 Initializes the printer port.
2 Reads the printer status.
The value of abyte can be 0 to 255.
Return Value
The value returned from any of these operations is the current printer status, which is obtained by ORing these bit values together:
Bit 0 0x01 Device time out
Bit 3 0x08 I/O error
Bit 4 0x10 Selected
Bit 5 0x20 Out of paper
Bit 6 0x40 Acknowledge
Bit 7 0x80 Not busy
Example :
/* biosprint example */
#include <stdio.h>
#include <conio.h>
#include <bios.h>
int main(void)
{
#define STATUS 2 /* printer status command */
#define PORTNUM 0 /* port number for LPT1 */
int status, abyte=0;
printf("Please turn off your printer. Press any key to continue\n");
getch();
status = biosprint(STATUS, abyte, PORTNUM);
if (status & 0x01)
printf("Device time out.\n");
if (status & 0x08)
printf("I/O 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;
}
Function : biosprint
Example Portability
Syntax
#include <bios.h>
int biosprint(int cmd, int abyte, int port);
Description
biosprint performs various printer functions on the printer identified by the parameter port using BIOS interrupt 0x17.
A port value of 0 corresponds to LPT1; a port value of 1 corresponds to LPT2; and so on.
The value of cmd can be one of the following:
0 Prints the character in abyte.
1 Initializes the printer port.
2 Reads the printer status.
The value of abyte can be 0 to 255.
Return Value
The value returned from any of these operations is the current printer status, which is obtained by ORing these bit values together:
Bit 0 0x01 Device time out
Bit 3 0x08 I/O error
Bit 4 0x10 Selected
Bit 5 0x20 Out of paper
Bit 6 0x40 Acknowledge
Bit 7 0x80 Not busy
Example :
/* biosprint example */
#include <stdio.h>
#include <conio.h>
#include <bios.h>
int main(void)
{
#define STATUS 2 /* printer status command */
#define PORTNUM 0 /* port number for LPT1 */
int status, abyte=0;
printf("Please turn off your printer. Press any key to continue\n");
getch();
status = biosprint(STATUS, abyte, PORTNUM);
if (status & 0x01)
printf("Device time out.\n");
if (status & 0x08)
printf("I/O 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;
}
No comments:
Post a Comment