C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
CURSOR.C
                                             Up Contents Index Back
─────Run-Time Library───────────────────────────────────────────────────────
 
/* 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 );
}
                                    -♦-