Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clear Screen and Cursor Positioning with 16bit C (DOS)

Status
Not open for further replies.

MuadDubby

Programmer
Sep 23, 1999
236
CA
I'm being driven B-( over here ...

Can anyone direct me to the functions I could use for clearing the screen and repositioning the cursor? I am using a 16bit compiler for DOS, and the output screen is a regular console (like a DOS BOX).

I looked at _settextposition() and _clearscreen(), but I'm having trouble with their libraries.

Anything else would be extremely appreciated ;-) [sig][/sig]
 

I'm don't have the compiler at hand, but i guess what you're looking for would be something like: clrscr() - found in <conio.h> if i'm not mistaking, in Borland C for clearing the screen, and
gotoxy(x,y) in the same heade (again if i'm not mistaking the header, anyway, u can easily find the libraries), which sets the cursor position in x,y coordinates on the screen. That is if you're in text mode.
If you're working in graphic mode, you use cleardevice for clearing the screen and outtextxy for text.
[sig][/sig]
 
Dear davidk13 (Programmer),
To clear the screen in dos mode in c is clrscr() function, include <conio.h>.

#include <stdio.h>
#include <conio.h>

void main(void)
{
clrscr();
printf(&quot;\n SUN SHAH&quot;);
}

now, you juct test & see the result.
thanks..
 
Why not use

#include <stdlib.h>

and system(&quot;cls&quot;) function

Isn't this also a possibility to clear screen in dos. [sig][/sig]
 
Seems like the conio.h solution might be more portable... [sig]<p>Mike<br><a href=mailto:michael.j.lacey@ntlworld.com>michael.j.lacey@ntlworld.com</a><br><a href= Cargill's Corporate Web Site</a><br>Making mistakes, so you don't have to. &lt;grin&gt;[/sig]
 
Thanx to all. I tried several things, and the best results came from using _settextposition() and _clearscreen() (keep in mind I also need to be to place the cursor in differne t places on the screen, and not just clear it).

Thanx again! [sig][/sig]
 
Hi,
I'm pretty rusty when it comes to C - been spending so much time programming in Windows lately =(, but why not use registers and interrupts?
CCTC1
Rob Marriott
rob@career-connections.net [sig][/sig]
 
Pretty good idea ... if I want to go low level. The pgm I'm working doesn't warrant that sort of complexity :)

Still, I suppose that doing it that way would give me a lot more control. Something to keep in mind. [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top