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

  1. /* setcurs.c -- moves cursor, checks out Setcurs() */
  2. #include <dos.h>
  3. #include <stdio.h>
  4. #define VIDEO 0x10
  5. #define SETCURSOR 2
  6. void Setcurs(unsigned char, unsigned char,
  7.              unsigned char);
  8. main()
  9. {
  10.     int row, col;
  11.  
  12.     printf("Enter row and column: (q to quit)\n");
  13.     while (scanf("%d %d", &row, &col) == 2)
  14.     {
  15.         Setcurs(row, col, 0);
  16.         printf("Enter row and column: (q to quit)");
  17.     }
  18. }
  19.  
  20. /* Setcurs() -- sets cursor to row, column, and page */
  21. void Setcurs(row, col, page)
  22. unsigned char row, col, page;
  23. {
  24.     union REGS reg;
  25.  
  26.     reg.h.ah = SETCURSOR;
  27.     reg.h.dh = row;
  28.     reg.h.dl = col;
  29.     reg.h.bh = page;
  30.     int86(VIDEO, ®, ®);
  31. }
  32.