[comp.lang.c] Need help with MS-DOS cursor functions

lh@garnet.berkeley.edu (Lee Han) (11/01/90)

Hi,

Is there anybody who can help me with MS-DOS cursor functions?  I thought
I read about hiding and showing the cursor with some INTERRUPT calls but
could remember where I read it.  Maybe you guys can give me a hint about
how to do this.  If you have a function written in C for this purpose, I
would really like to get a copy of it.

Thanks a lot.

- Lee

gordon@osiris.cso.uiuc.edu (John Gordon) (11/02/90)

	Here you go.


/******************
*  cursor.c
******************/

#include <stdio.h>
#include <dos.h>

void cursor_on(void)  /* turns the cursor off, using an interrupt */
{
  union REGS r;

  r.h.ah = 1;         /* 1 is the cursor-modifying portion of structure r */
  r.h.ch = 6;         /* starting scan line for cursor */
  r.h.cl = 7;         /* ending scan line */

  int86(0x10, &r, &r);
}

void cursor_off(void)  /* turns the cursor on, using an interrupt */
{
  union REGS r;

  r.h.ah = 1;          /* 1 is the cursor-modifying portion of structure r */
  r.h.ch = -1;         /* starting scan line (neg. means turn off) */
  r.h.cl = 0;          /* ending scan line */

  int86(0x10, &r, &r);
}


---
John Gordon
Internet: gordon@osiris.cso.uiuc.edu        #include <disclaimer.h>
          gordon@cerl.cecer.army.mil       #include <clever_saying.h>
GEnie:    j.gordon14                  

herrj@valnet.UUCP (Jonathan R. Herr) (11/03/90)

gordon@osiris.cso.uiuc.edu (John Gordon) writes:

> 	Here you go.

> /******************
> *  cursor.c
> ******************/

> #include <stdio.h>
> #include <dos.h>
> 
> void cursor_on(void)  /* turns the cursor off, using an interrupt */
> {
    [ ... ]
> }

> void cursor_off(void)  /* turns the cursor on, using an interrupt */
> {
    [ ... ]
> }
> John Gordon

Okay, I'm confused.


--------------=======]]]]]]]> Jon Herr <[[[[[[[=======--------------
\\\\\\\\\\\\\\\\ Valley BBS Network Administratior /////////////////
///////////// E-mail to: herrj@silver.ucs.indiana.edu \\\\\\\\\\\\\\
--------------=======]]]]]]]]]]]]*[[[[[[[[[[[[[=======--------------

gordon@osiris.cso.uiuc.edu (John Gordon) (11/06/90)

	Errr...confused about what?  The original poster said that he
needed some MS-DOS cursor routines, so I posted some. (Turbo C)  What
are you confused about?

gordon@osiris.cso.uiuc.edu (John Gordon) (11/06/90)

	Sorry about the confusing comments on my cursor code.  The function
names are right, the comments are switched.