Advertisement

clearing the text screen

Started by March 10, 2000 10:10 PM
3 comments, last by deakin 24 years, 7 months ago
How would I go about clearing the screen in text mode using visual c++ 6.0? I know this has been asked before, but I couldnt find the post. Also, how would I set the cursor to a specific position? Thanks! - Daniel http://sw.mtx.net/daniel/
- DanielMy homepage
I beleve clrscr() will clear the text screen you''ll need to include conio.h its non-standard so you might not have it but every compiler I have ever seen has it.
------------------------------"My sword is like a menacing cloud, but instead of rain, blood will pour in its path." - Sehabeddin, Turkish Military Commander 1438.
Advertisement
I don''t believe that VC++ 6.0''s version of conio has the clrscr() function in it. I don''t have an answer for your question; just wanted to point this out.
The following article is available at microsoft''s site. The code is not great, my screen flickers when being cleared. Could be my cheap video card.


HOWTO: Performing Clear Screen (CLS) in a Console Application
ID: Q99261

http://support.microsoft.com/support/kb/articles/Q99/2/61.ASP
This is what I use to clear the screen in text mode for Visual C++ 6.0

void GotoXY( int x, int y )


{



HANDLE screen = GetStdHandle( STD_OUTPUT_HANDLE );


COORD _ = { x, y }; SetConsoleCursorPosition( screen, _);



}



void ClrScr()


{



HANDLE screen = GetStdHandle( STD_OUTPUT_HANDLE ); DWORD NumberOfCharsWritten;


COORD _ = { 0, 0 };


FillConsoleOutputCharacter ( screen, ' ', 0xffff, _, &NumberOfCharsWritten
);


SetConsoleCursorPosition( screen, _);



}



Edited by - Ranok on 3/10/00 11:33:56 PM
---Ranok---

This topic is closed to new replies.

Advertisement