home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / qc_prog / chap14 / portinfo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-04-07  |  560 b   |  21 lines

  1. /* portinfo.c -- reads port values                    */
  2. /* program list -- portinfo.c (inp() not in core lib) */
  3.  
  4. #include <conio.h>
  5. #include <stdio.h>
  6. main()
  7. {
  8.     unsigned int portnum;
  9.     int regvalue;
  10.     
  11.     printf("Enter number (in hex) of the port ");
  12.     printf("you wish to read: ");
  13.     while (scanf("%x", &portnum) == 1)
  14.         {
  15.     regvalue = inp(portnum);
  16.     printf("\nValue returned for port %x is %d (decimal)"
  17.            "  %x (hex)\n", portnum, regvalue, regvalue);
  18.     printf("Next port? (q to quit): ");
  19.         }
  20. }
  21.