home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_144 / 1.ddi / CLIBSRC.ZIP / GOTOXY.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.2 KB  |  49 lines

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