hey how to clear the screen in c++ i m using dev c++. clrscr()doesnot work
sidra 100
-2
Junior Poster
Recommended Answers
Jump to Postfrom MSDN:
…#include <windows.h> void clrscr(void) { COORD coordScreen = { 0, 0 }; DWORD cCharsWritten; CONSOLE_SCREEN_BUFFER_INFO csbi; DWORD dwConSize; HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); GetConsoleScreenBufferInfo(hConsole, &csbi); dwConSize = csbi.dwSize.X * csbi.dwSize.Y; FillConsoleOutputCharacter(hConsole, TEXT(' '), dwConSize, coordScreen, &cCharsWritten); GetConsoleScreenBufferInfo(hConsole, &csbi); FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten); SetConsoleCursorPosition(hConsole, coordScreen); }
Jump to PostAnd now for the obligatory question: why do you think you need to clear the screen? There are only a handful of reasons where it makes sense outside of a GUI environment, and quite a few reasons why it's a bad idea in a textual environment (the kind of environment …
All 7 Replies
Nick Evan
4,005
Industrious Poster
Team Colleague
Featured Poster
Skeen
0
Junior Poster in Training
MASILELA
0
Newbie Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
mike_2000_17
commented:
thumbs up from another "purist"
+13
adityatandon
23
Junior Poster in Training
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
adityatandon
23
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.