home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 26 / CD_ASCQ_26_1295.iso / vrac / volume_3.zip / KKKK.CPP < prev    next >
C/C++ Source or Header  |  1995-11-02  |  1KB  |  68 lines

  1. #include "c:\tc\keyboard.h"
  2.  
  3.  
  4. int Write(char *);
  5. unsigned char Write_Edit(char i[]);
  6.  
  7. void main(void)
  8. {
  9. unsigned char chr,asci;
  10. clrscr();
  11. while(Write(&asci))
  12.     {
  13.     ;
  14.     }
  15. return;
  16. }
  17.  
  18. int Write(char *asci)
  19. {
  20. unsigned char chr;
  21. if( (chr) AND ( (int)chr != 27) )
  22.     {
  23.     *asci = chr;
  24.     cout << chr;
  25.     }
  26. else if ( (int)chr == 27)//ESC quits
  27.     {
  28.     return FALSE;
  29.     }
  30. else *asci = NULL;
  31. return TRUE;
  32. }
  33.  
  34.  
  35.  
  36. unsigned char Write_Edit(char i[])
  37. {
  38. // if there is a normal ascii key waiting then return it, else return 0
  39. if (_bios_keybrd(_KEYBRD_READY))
  40.     {
  41.      unsigned char temp = (_bios_keybrd(_KEYBRD_READ));
  42.      if( (int)temp ==  8)//Backspace
  43.         {
  44.         gotoxy(wherex() - 1,wherey());
  45.         cout << " ";
  46.         gotoxy(wherex() - 1,wherey());
  47.         temp = NULL;
  48.         return temp;
  49.         }
  50.      if( (int)temp ==  27)
  51.         {
  52.         return temp;
  53.         }
  54.      if( (int)temp ==  13)//Enter
  55.         {
  56.         cout << "\n";
  57.         temp = NULL;
  58.         return temp;
  59.         }
  60.      if( ( (int)temp >=  32) AND ( (int)temp <=  126) ) //ASCII Character
  61.         {
  62.         return temp;
  63.         }
  64.     return(0);
  65.     }
  66. else return(0);
  67. } // end Write_File
  68.