graphics.hlp (
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
CURSOR.C
◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
/* CURSOR.C illustrates cursor functions including:
* _settextcursor _gettextcursor _displaycursor
*/
#include <conio.h>
#include <stdio.h>
#include <graph.h>
/* Macro to define cursor lines */
#define CURSOR(top,bottom) (((top) << 8) | (bottom))
void main()
{
short oldcursor, newcursor;
unsigned char top, bottom;
char buffer[80];
struct videoconfig vc;
/* Save old cursor shape and make sure cursor is on. */
oldcursor = _gettextcursor();
_clearscreen( _GCLEARSCREEN );
_displaycursor( _GCURSORON );
/* Change cursor shape. */
for( top = 7, bottom = 7; top; top-- )
{
_settextposition( 1, 1 );
sprintf( buffer, "Top line: %d Bottom line: %d ", top, bottom );
_outtext( buffer );
newcursor = CURSOR( top, bottom );
_settextcursor( newcursor );
getch();
}
_outtext( "\nCursor off" );
_displaycursor( _GCURSOROFF );
getch();
_outtext( "\nCursor on" );
_displaycursor( _GCURSORON );
getch();
/* Restore original cursor shape. */
_settextcursor( oldcursor );
_clearscreen( _GCLEARSCREEN );
}