My photo
Bangalore, Karnataka, India
Extending one hand to help someone has more value rather than joining two hands for prayer

Archives

program which takes a number from keyboard and gives it ascii value,scan code and status code

Tuesday, September 1, 2009

#include<iostream.h>
#include<conio.h>
#include<dos.h>
void getkey(int &ac,int &sc,int&st)
{  REGS m,n;
   m.h.ah=0x00;
   int86(22,&m,&n);
   sc=n.h.ah;
   ac=n.h.al;
   m.h.ah=0x02;
   int86(22,&m,&n);
   st=n.h.al;
}
void main()
{  clrscr();
   REGS m,n;
   int sc,ac,st;
   m.h.ah=0x00;
   int86(22,&m,&n);
   sc=n.h.ah;
   ac=n.h.al;
   m.h.ah=0x02;
   int86(22,&m,&n);
   st=n.h.al;
   cout<<"scan code: "<<sc<<endl;
   cout<<"ascii code: "<<ac<<endl;
   cout<<"status code: "<<st<<endl;
   getch();
}

0 comments: