home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c065 / 1.ddi / CLIB1.ZIP / GOTOXY.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-06-07  |  1.6 KB  |  50 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - gotoxy.c
  3.  *
  4.  * function(s)
  5.  *        gotoxy - moves the text cursor.
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*[]------------------------------------------------------------[]*/
  9. /*|                                                              |*/
  10. /*|     Turbo C Run Time Library - Version 3.0                   |*/
  11. /*|                                                              |*/
  12. /*|                                                              |*/
  13. /*|     Copyright (c) 1987,1988,1990 by Borland International    |*/
  14. /*|     All Rights Reserved.                                     |*/
  15. /*|                                                              |*/
  16. /*[]------------------------------------------------------------[]*/
  17.  
  18. #include <_video.h>
  19. #include <conio.h>
  20.  
  21. /*------------------------------------------------------------------------
  22.  
  23. Name        gotoxy - moves the text cursor
  24.  
  25. Usage        void gotoxy(int column, int row)
  26.  
  27. Prototype in     conio.h
  28.  
  29. Description    Moves the text cursor to location (x, y) in the current window.
  30.  
  31. *------------------------------------------------------------------------*/
  32.  
  33. void gotoxy(int column, int row)
  34. {
  35.     uchar r,c;
  36.  
  37.     /* translate to physical coord */
  38.     r = row-1; r += _video.windowy1;
  39.     c = column-1; c += _video.windowx1;
  40.  
  41.     if ((r < _video.windowy1) || (r > _video.windowy2) || ( c < _video.windowx1) || (c > _video.windowx2))
  42.         return;
  43.  
  44.     _DL = c;
  45.     _DH = r;
  46.     _AH = V_SET_CURSOR_POS;
  47.     _BH = 0;
  48.     _VideoInt();
  49. } /* gotoxy */
  50.