home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / magazine / drdobbs / c_spec / sources / b_getc.c next >
C/C++ Source or Header  |  1986-02-20  |  868b  |  29 lines

  1. #include <stdio.h>
  2. #include <dos.h>
  3.  
  4. /*   B_GETC.C        Get a character with a direct video bios call.
  5.  *            this routine can be used to complement stderr as
  6.  *   it can be used to get characters from the keyboard, even when input
  7.  *   redirected. The typed character is returned in the low byte of the
  8.  *   returned integer, the high byte holds the auxillary byte used to
  9.  *   mark ALT keys and such. See the Technical Ref for more info.
  10.  *
  11.  *   Copyright (C) 1985 Allen I. Holub. All rights reserved.
  12.  *
  13. /*----------------------------------------------------------------------*/
  14.  
  15. extern void    int86( int, union REGS *, union REGS *);
  16.  
  17. #define    KB_INT    0x16    /*    Keyboard BIOS interrupt             */
  18. #define GETC    0x00    /*    Getc is service 0            */
  19.  
  20.  
  21. int    b_getc()
  22. {
  23.     union REGS    Regs;
  24.  
  25.     Regs.h.ah = GETC ;
  26.     int86( KB_INT, &Regs, &Regs );
  27.     return( Regs.x.ax );
  28. }
  29.