Advertisement

Clearing the screen in text mode

Started by February 01, 2000 11:03 PM
4 comments, last by Ranok 24 years, 10 months ago
Does anybody know how to clear the screen in text mode and return the position of the output to the top using cout and cin?
---Ranok---
Depends on what compiler you''re using...I know Borland C++ has a function called clrscr() that''s in conio.h...but I don''t think VC++ does...there''s probably other ways, but I don''t know them.
Chris
Advertisement
Visual c++ uses

system("cls");

instead.
Just because the church was wrong doesn't mean Galileo wasn't a heretic.It just means he was a heretic who was right.
If you are using a dos compiler like borland c++, try using

clrscr();

and then

gotoxy(1,1); (to return to the top of the screen)

I think these functions are in conio.h
- DanielMy homepage
Why is system( "cls" ); so slow? It takes about a second to clear the screen?
---Ranok---
system("cls") is something like running command.com then run cls. that''s why it is slow!


For vc++, try searching funtions in msdn like: SetConsoleTextAttribute, WriteConsole and alikes... i think they have clear screen too. Click the "group" button.
"after many years of singularity, i'm still searching on the event horizon"

This topic is closed to new replies.

Advertisement