Saturday, 17 September 2011

Printer Troubleshooting

Working with Printers

#include <dos.h>
#include <stdio.h>
#include <conio.h>
#define MAX 40
#define CR 13
#define LF 10
union REGS inregs,outregs;
struct SREGS segregs;
int mask,i;
char strng[MAX];
void main()
{       clrscr();
printf(“\n\n Printer Troubleshooting”);
printf(“\n\n Enter a string terminated by a <cr>”);
for(i=0;i<MAX-2;i++)
{
inregs.h.ah = 0×01;
intdos(&inregs,&outregs);
if (outregs.h.al == CR)
{          printf(“\n”);
strng[i] = CR;
strng[i+1] = LF;
break;
}
else
strng[i] = outregs.h.al;
}
strng[MAX-2] = CR;
strng[MAX-1] = LF;
inregs.h.ah = 2;
inregs.x.dx = 0;
int86(0×17,&inregs,&outregs);
mask = 0×80;
outregs.h.ah &=mask;
if (outregs.h.ah == 0)
printf(“\n Printer in OFFLINE”);
else
printf(“\n Buffering”);
for (i=0;i < strlen(strng); ++i)
{ inregs.h.ah = 0×05;
inregs.h.dl = strng[i];
intdos(&inregs,&outregs);
}
getch();
}

0 comments:

Post a comment